Ruby Intro/General Info (I) Flashcards
Who created Ruby? When? What was the main idea behind it?
Yukihiro Matsumoto
Mid-1990s
“software should be understood by humans first and computers second”
Ruby on Rails is a framework. What is a framework?
SHORT ANSWER: a collection of libraries that make building web applications easier. they can automate common activities done in web development
(database access, session management, etc.)
LONG ANSWER: A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs.
These frameworks provide a standard way to build and deploy web applications on the World Wide Web. Web frameworks aim to automate the overhead associated with common activities performed in web development. For example, many web frameworks provide libraries for database access, templating frameworks, and session management, and they often promote code reuse.[1]
What are three layers of abstraction with regard to a cell phone?
(think of three different people)
normal user = doesn’t care about what’s under the hood/just taps icons and makes calls/uses the phone’s interface
technician = must know how the phone’s components interact with the various sub-systems of the phone
programmer = must know all about the OS
True or false?
Higher-level computer languages are just abstractions of lower-level ones.
True
STARTING HIGHER AND MOVING TO LOWER:
- Ruby on Rails
- Ruby
- C
- Assembly Language
- Machine Language (binary/zeros and ones/something your computer’s CPU understands)
Why is it a bad idea to try and learn Rails before you learn Ruby?
Because Rails is an abstraction of Ruby. If you don’t know how Ruby works, it will be that much harder for you to grasp Rails
What is a code editor used for?
To create plain text documents with no styling or formatting
In VS Code, how many spaces should your tab ident be set to?
two spaces
In VS Code, what is # used for?
a one-line comment
What is snake case formatting? When do you use it?
What is camel case formatting? When do you use it?
When do you use all upper-case letters?
When you define or initialize a method, variable, or file
( my_variable = 6, def add_six(number), etc.)
When naming a class (class MyFirstClass, etc.)
When you define a constant variable
(FIVE = 5, etc.)
What is another name for the Ruby documentation?
API
“Have you read the Array API?”
In the Ruby docs, what do these symbols mean in the Methods menu?
: :
#
: : class methods
instance methods
What is the difference between class methods and instance methods?
class methods: are called directly to a class: String.new("blue") ( b = String is the name of a class)
instance methods: are called to any instance of the class: “Hello”.split
(“Hello” is an instance/example of a string, and .split is an instance method)
True or false?
In Ruby, every class (String, etc) sub-classes from some “parent”
True
For example, the parent of String is Object
There are three places a class can draw methods from. What are they?
1-the instance and class methods in the “Methods” menu on the left side of the screen
2-the instance and class methods available to the parent class of the class you're reading about (String has a parent called Object, and object has methods that String can use)
3-the instance and class methods available in the “Included Modules” menu
What is irb?
Ruby’s built-in interactive environment that lets you test code snippets and practice coding