Ruby Master Class Christina Thompson @Xtina_Starr [email protected].

12
Ruby Master Class Christina Thompson @Xtina_Starr [email protected]

Transcript of Ruby Master Class Christina Thompson @Xtina_Starr [email protected].

Page 1: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Ruby Master Class

Christina Thompson@Xtina_Starr

[email protected]

Page 2: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Intro

• Learning to code with Skillcrush• Found a new passion…Now what?• Ada

Page 3: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Why I love

• Beginner Friendly• It’s Flexible• The Community• Rails

Page 4: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

The Struggles of Learning

• Learning your first programming language is really hard!– It’s abstract and not really natural.

• Git, Ruby, and the Ruby Docs are magic, but I promise it “gits” better!

Page 5: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

When It Started to Click

• The HTTP Request Cycle

Page 6: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Understanding the HTTP Request Cycle

• Helped focus on a particular state.• State – all of the stored information (e.g.

methods and variables) at a given instances in time that a program has access to.

Page 7: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

State

Page 8: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Ask the Right Questions

• What methods and variables are available in a particular state?– Tip: to figure out what methods are available to an

object you can call .methods on it• What type of object are you working with?• What a method is called on an object what

value is return?

Page 9: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Debugging

• SyntaxError - Raised when encountering Ruby code with an invalid syntax.– [1, 2, 3, 4].delete(2

• TypeError - Raised when encountering an object that is not of the expected type.– [1, 2, 3].first(“two”)

• NameError - Raised when a given name is invalid or undefined.– string.chomp

• ArgumentErrors - Raised when the arguments are wrong and there isn't a more specific Exception class.– [1, 2, 3, 4].delete

Page 10: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Debugging

• Using puts and inspect• Better Errors Gem

Page 11: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Getting Better At Ruby

• Practice practice practice• Being patient it will come• Reading other people's code• Explaining your code to others• Solving problems like FizzBuzz in different

ways• Asking questions• Being fearless

Page 12: Ruby Master Class Christina Thompson @Xtina_Starr c.thompsonms@gmail.com.

Resources

• Ruby Docs• RubyMonk (tutorial)• Git Immersion (tutorial)• Stack Overflow• Learn to Program - The Facets of Ruby Series by

Chris Pine (book)• Computer Science Basics in Ruby (book)• The Ruby Style Guide• Google :-)