- See more at: http://blogtimenow.com/blogging/automatically-redirect-blogger-blog-another-blog-website/#sthash.YsVbCxL0.dpuf Journey to Becoming a Web Developer: african american
Showing posts with label african american. Show all posts
Showing posts with label african american. Show all posts

Tuesday, February 11, 2014

Single Table Inheritance

I'm currently building an app that needs to have a base model and sub-models. I wasn't sure how to do that, so I did some research online and found STI or Single Table Inheritance.  The idea behind it is that the sub-models will inherit from the base model, so it will be able to use all of the attributes of the base model.  In the migration of the base model you must have a type field. This is how rails knows that other models will be inheriting from this model.  In the example below the singer and dancer models will inherit from the entertainer model, so now we can create a new entertainer object an be able to use the attributes associated with entertainer on that object.










Monday, January 20, 2014

Anatomy of a JavaScript function

JavaScript functions are very different from Ruby methods. While reading Intro to Functions I became quite confused because I am so used to the way methods work in Ruby. I did understand some of it. Here is what I observed.

In JavaScript defining properties of pure functions is that they always return the same values when given the same arguments.
A function is built by first using the word function then the name we want to call the function followed by the names of the argument/s in parenthesis.  Last would be the body of the function. Ex:






Return is used to define the value that the function returns. If there is no expression after return the function will return undefined


In this example both the top level variable and the local variable are named variable.  The function printVariable is called inside of the function test. Even though printVariable was called inside of test the local variable is not available to the printVariable function.


Lexical Scoping is when a variable visibility is determined by the functions placement in the program text. Both local variables and top-level variables are visible. In the example because the child function was defined in the parent function the local variable from the parent function is the only variable visible to it.



Sunday, October 20, 2013

Accepted into the Flatiron School!

Hello all.  On Friday October 11th I found out I was accepted into the Flatiron School Fellowship program. I'm really excited and I hope that I excel while I'm here. Since then I've been trying to get the prework done. Currently I'm doing the Ruby Foundations on Treehouse. I will also try to write a post daily. Until next time.

Wednesday, August 7, 2013

Ruby

I'm trying to get a better grasp of Ruby so along with reading Zed Shaw's book I've been doing the lessons on RubyMonk.com. RubyMonk is a pretty good site for learning Ruby, so I'd recommend it. I'm still not the best I Ruby, but I've definitely gotten better. Practice makes perfect. I still haven't solved my Michael Hartl's tutorial issue. Sunday I plan on going to hacker Meetup, so I hope I can get help there. I really can't wait to get back into the tutorial. Once I finish it I want to work on my own Rails site. Not sure what it will be as yet.  That's all for now.