Week 1

“The mind, once stretched by a new idea, never returns to its original dimensions.”

― Ralph Waldo Emerson

Cheesy quote? Maybe. Did I google it? Mos def. It’s just that after reading my first post again, it reminded me of this quote. I’m surprised that I remember this quote for some odd reason. I remember the first time discovering it when I was at the dental office. I was laying down on one of those reclinable dental chairs and I saw a framed picture of a desert/sand dunes with this quote as a caption. I thought to myself “weird flex dentist lady but ok” It was actually interesting to read my first post again before writing this one. It was interesting in many ways. First, what I found difficult at that time seems easier now but not because I have gained more skills or knowledge with HTML and CSS. There are still plenty of syntaxes and concepts left for me to explore. I am comparing apples and oranges here but I think HTML & CSS is easier when you compare them to Javascript because JS as language, gives you the ability to do a lot more, therefore, more to learn..and fail (for once I am ok with that) but the possibilities are endless.

I’m rambling again. I have to remember why I started writing this post and this blog in the first place. End goal is to see how far I’ve come. So let’s focus on the concepts that I have learned or didn’t learn..Ok more like struggled with. I like to think that I retained some information..

Useful things that I have learned so far (from broad to specific things, e.g. concepts, labs, methods, functions, etc.):

Objects and Class: This first week really solidifies my understanding of object oriented programming. I kinda-sorta grasped the concept when I was learning C# back in college but not really you know? OOP as a whole/big picture can be oversimplify by the formula A=B=C therefore A=C (ok not really but for now this is the simplest way I can explain it). My favorite lab that goes along with this has to be the RPG lab! I mean cmon..

RPG Lab: I love this lab for obvs reasons!
Prompt: First, create a Monster classAdd properties for Health, Strength and GoldAdd a constructor to initialize our valuesAdd a method to print out the Monster’s health, strength, name and goldCreate a Monster and print out that Monster’s stats.
Next, create a Boss class that inherits from the Monster classAdd a property to the Boss class called ExperiencePointsAdd a method to the Boss class called Heal that heals the Boss to full healthCreate a Boss and print out that Boss’s statsSet the health of the Boss to 0(zero). Next call the Heal method on our Boss and then print out the stats again.

Solutions/Code:
class Monster { constructor(name, health, strength, gold) {
super(name, health, strength, gold)
this.name = name;
this.health = health;
this.strength = strength;
this.gold = gold;
this.monster = monster; }
printStats() {
console.log(`The ${this.name} has ${this.health} health, ${this.strength} strength, and is worth ${this.gold} gold`); }}
let Demon = new Monster("Demon", 9000, 2500, 9000)Demon.printStats();

class Boss extends Monster { constructor(name, health, strength, gold, exp) { super(name, health, strength, gold);
this.exp = exp;
this.fullhealth = health; //this.fullhealth property is set to equal the original boss's health }
heal() { this.health = this.fullhealth; }}
let monster0 = new Boss("Demon Lord", 666666, 666666, 666666, 666666)monster0.printStats()monster0.health = 0;monster0.printStats()monster0.heal()monster0.printStats()


Arrays: I freakin’ love arrays! I never thought I’d say this but I actually find it very useful. For some reason I couldn’t grasp the array concept with C# but I get it with JS! Also maybe at the time I was learning Arrays along with Matrixes, and C# is less forgiving than JS. Arrays is more than just a list. It’s a list that you can use in a function to do specific things! Which bring me to my next favorite lab!

Fav (Array) Lab & Solutions: I like this problem for many different reasons. The first reason is the premise of the prompt. The second reason because it uses an array in a function. The last reason is because it taught me how to write my first and VERY basic algorithm! i iS dA sMaRt GuY..durr. Jokes aside, below is the prompt and solution.

prompt: Learning to code around your full time job is taking over your life. You realize that in order to make significant steps quickly, it would help to go to a coding bootcamp. You decide that rather than leaving work totally, you will request a sabbatical so that you can go back to work post-bootcamp and be paid while you look for your next role.
You need to approach your boss. Her decision will be based on three parameters:
val = your value to the organisation, happ = her happiness level at the time of asking The number of letters from ‘sabbatical’ that are present in string ‘x’. Note that if x contains three instances of the letter ‘l’, that still scores three points, even though there is only one in the word sabbatical. If the sum of the three parameters (as described above) is > 22, return // ‘Sabbatical! Boom!’, else return ‘Back to your desk, boy.’.


solution:
const letters = ["a", "b", "c", "t", "i", "l", "s"];
function sabb(text, val, happ) {
let counter = 0; for (let letter of text.toLowerCase()) {
if (letters.includes(letter)) { counter++ }
sum = val + happ + counter; } if (sum > 22)
console.log('Sabbatical! Boom!')
else return console.log('Back to your desk, boy')}

* // ============== Test Case ===================// *///
sabb('What do you mean I cant learn to code??', 8, 9);
sabb('Can I have a sabbatical?', 5, 5) = 'Sabbatical! Boom!'
sabb('Why are you shouting?', 7, 2) = 'Back to your desk, boy.'
sabb('What do you mean I cant learn to code??', 8, 9) = 'Sabbatical! Boom!'
sabb('Please calm down', 9, 1) = 'Back to your desk, boy.'

Concepts or “Tings” I hate/struggled with:
Document Object Model: DOM is DUMB. Ok jokes aside, Document Object Model is ridiculous and tedious. I get that this is how people code most web apps 10 years ago and to be honest 4 days ago I thought it was the only way to code. I mean that is the basic concept of building web pages/apps. I just didn’t know how difficult it would be. There are just so many concepts you have to piece together in order to make it work. I’m glad to know that React can help ease this pain (thank you ‘early’ facebook! Not the now fb where you steal people’s info) I’m excited to be learning React in the upcoming week! From what I know so far about React is that it is a library that can help build a user interface a lot easier than the DOM.

Alright. That’s all I have for Week 1. Time to turn in and get ready for Week 2, which starts at 9 AM tomorrow! ~Soosh out!
P.s. I’m still working on a better sign off

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s