Trying to think and solve algorithmically has been extremely difficult for me especially when it comes to solving problems through Code Wars. There are some I can solve, while there are many I cannot. But when I check out the solutions, the puzzles fit together in my head and I can understand what is going on.

BUT that doesn’t help if I don’t know how to solve problems myself most of the time. My good friend Corey actually introduced me to this book called Cracking the Coding Interview by Gayle McDowell. I purchased it on Amazon Prime and it came within two days. I’ve been flipping thru the pages during my spare time as well as trying to absorb the content overall. I really hope it will help me with problem solving in the future. There have been many good reviews on it.

My Progress on Swift!

 

download

I’ve cleared out one section on Skill Stack on learning Swift. And I gotta say; it is pretty enjoyable! One of my hobbies is learning something new all the time and I love how learning programming languages gives me such a fulfilling sense of accomplishment.

I’ve learned how to create labels and add buttons that provide text once you click on them. I’ve also learned If statements in Swift and how much of an impact they can make to your code. It’s pretty neat.

The past few days I’ve been trying to troubleshoot this error I’ve made on xcode. Every single time I launched the simulator, it would crash and show this error code; SIGBRT thread 1 or something of the sort. I had to backtrack many times to figure out what went wrong. What was the problem? I didn’t even know I created another path on one of my UI buttons. I deleted that and bam! My simulator didn’t even crash anymore.

I felt a huge wave of relief and self-accomplishment because I, for one, figured out the problem on my own. It took me about a day and a half but I finally did it. I know it is something very minuscule but can you imagine how great I felt, as a beginner programmer, that I troubleshooted this problem MYSELF? 😀

It goes to show how important it is to TESTTESTTEST your code little by little so you won’t get lost in transition along the way, as well as showing how one little mishap can cause your entire project to crash. Whew!

A Little Update;

Seasons greetings! I know I haven’t written a post in so long. I’ve been keeping busy with work, studying, and just life in general. My boyfriend’s mother has some health issues that needed to be tended to and I am glad she is well now! There were other priorities that had to be taken care of but I’m glad I am back!!

UPDATE;; I’ve been looking into this bootcamp school in LA called Coding Dojo… Went to their open house a couple of weeks ago and was intrigued by their teaching curriculum. Not many *bootcamps* out there teach full stack and it’s great to have Coding Dojo so close to home. Well, approximate drive would be about a little over an hr but…it beats having to find an apartment out there and having to pay more out of my pocket. I’ve been studying on and off to have myself stand out from the rest of the group but I know I shouldn’t set my expectations like that and know for sure that there will be more experienced programmers in my cohort, even in the beginning.

I guess I should say that no matter how much I study for this, research and become an expert “Google-r”, there is still so much to learn and I know I’m going to be pulling my hair out a bunch of times during those 3 months.

I’ve been working in retail and cafe jobs that this is my chance to finally go up in life, y’know? It’s a good feeling to know that I will be quitting my job some time in May… Wow! That is pretty soon.

 

Cheers!

Speaking Object Oriented

  • Class: tells Ruby to make a new type of ‘thing’
  • Object: Two meanings;; The most basic type of thing and any instance of some ‘thing’
  • Instance: What you get when you tell Ruby to create a class
  • Def: How you define a function within a class
  • @: Inside the functions of a class; @ is a variable for the instance/object being accessed
  • Inheritance: The concept that one class can inherit traits from another class
  • Composition: Concept that a class can be composed of other classes as parts
  • Attribute: A property classes have that are from composition and are usually variables hh
  • is-a: A phrase to say that something inherits from another. As in a “salmon” is-a fish

Modules, Classes, Objects

  • Modules are like hashes
    • A Ruby file with some functions or variables in it inside a module…end..block
    • You import that file
    • You can access the functions or variables in that module with the .(dot) operator
  • Imagine I have a module named mystuff.rb and I put a function in it called Apple:
    • module My Stuff
      • def Mystuff.apple()
      • puts “I AM APPLES!”
      • end
    • end
  • Once I have this code, I can module MyStuff with require then access the Apple function:
    • require “./mystuff.rb”
      • MyStuff.apple()

Comparing to Hashes

  • In hash, the key is a string and syntax is [key]
  • In module, the Key is an identifier and syntax is .key
  • They are nearly the same thing…

Classes Are Like Modules

  • Think about module as a specialized hash that can store Ruby code so you can access it with . operator
  • Classes: A way to take a grouping of functions and data and place them inside a container so you can access them with . operator
    • class MyStuff
      • def initialize ()
        • @tangerine = “And now a thousand yrs in between”
      • end
      • attr_reader :tangerine
      • def apple
      • puts “I AM APPLES!”
      • end

Why Classes are Better than Modules

  • You can take a class and craft as many of them as you want. You cannot do that with modules

Sequence of Creating Classes

  1. Ruby looks for Mystuff and sees that it is a class
  2. Ruby crafts an empty object with all of the functions you’ve specified in the class using def because you did MyStuff.new
  3. Ruby sees if you made initialize function and if you have, it calls that function to initialize your newly created object
  4. In MyStuff function Initialize, I then use @tangerine, which tells Ruby it wants tangerine variable as part of object
    1. $ = global @ = object
  5. In this case, @tangerine is set to song lyric
  6. Now Ruby can assign it to thing variable

 

What About Hashes?

  • Hash: Way to store data like a list. But instead of using numbers, you can use anything. It is basically a database for storing and organizing data.
    • You can only use NUMBERS for arrays
  • stuff { ‘name’ => ‘Jess’, ‘age’ => ’25’, ‘height’ => 5 ft 1}
  • puts stuff[‘name’]
    • => Jess
  • puts stuff[‘age’]
    • => 25
  • You can put new stuff into hash with strings
    • stuff[1] = “Wow”
    • stuff[2] = “Neato”
  • puts stuff[1]
    • => Wow
  • You can also delete stuff
    • stuff.delete(‘city’)
      • =>San Francisco
    • stuff.delete(2)
      • “Neato”

Hash is used to map or associate things you want to store keys you need to get them

Difference between hash and arrays?

  • Array is an order of items
  • Hash is for matching some items (“keys”) to other items (“values”)