WHY IS CODING SO CONFUSING?
After receiving word that I was accepted into the Flatiron School’s Software Engineering Immersive training program, I got down on my knees and thanked the Lord. Since then I have learned a great deal about both JavaScript and Ruby. However, I have also learned how little I actually do know about JavaScript and Ruby.
Within the short time of being immersed in the Ruby programming language and our Modular (Mod 1) training, I have discovered one glaring observation about my relationship with programming in general; Oftentimes I am completely bewildered by the constant juggling of the same information being used in increasingly complex ways.
For this subject, I will attempt to explain what are some of the basic components that are part of the Ruby programming language to give some clarity to this extremely enjoyable art of composition and science of operations as the founder of Flatiron, Avichel “Avi” Flombaum, has stated.
One of several confusing issues for me were the basic number of programming components within the programming language itself. As an example, Ruby programs consist of four types of variables: Local, global, instance, and class.
Methods are the building blocks of Local and global variables are used mostly in two spaces; inside and outside of a program’s scope.
Local variables tend to be used within the body of code– better known as a code block–between a “do” and “end” statement within a method (or macro). Methods begin with the keyword “def” which is an abbreviation of definition. What goes before the “do” statement varies on the purpose of the method (or macro), itself.
What is a Macro? Macros were introduced in Mod 1 as part of the Object Accessors:
Attribute readers = attr_reader,
Attribute Writers = attr_writer, and
Attribute Accessors = attr accessor)
that were part of the getter and setter methods. Macros are like methods with the exception that a macro will return more code as opposed to a regular datatype that a method would return.
The following two paragraphs are excerpts from rubylearning.com
A Symbol is the most basic Ruby object you can create. It’s just a name and an internal ID. Symbols are useful because a given symbol name refers to the same object throughout a Ruby program. Symbols are more efficient than strings. Two strings with the same contents are two different objects, but for any given name there is only one Symbol object. This can save both time and memory.
A Symbol object is created by prefixing an operator, string, variable, constant, method, class, module name with a colon. The symbol object will be unique for each different name but does not refer to a particular instance of the name, for the duration of a program’s execution. Thus, if Fred is a constant in one context, a method in another, and a class in a third, the Symbol :Fred will be the same object in all three contexts.
Now, here is where there are many options of how this method will be either the main component or one of several components within an algorithm — — — — — — — — — — -
The one item that I find most confusing are the brackets. Now brackets are often used in arrays and hashes but sometimes those brackets are needed in order to get to a sub element of an array or a hash. In my opinion that’s where the confusion comes in because now we’re talking about a branch that is stimming out a tree that is sticking out for me full branch from only a mere branch, which of course is impossible in the real world however in the computer world everything is possible. what does the key word self mean in Ruby? It has many purposes I believe it’s most prominent in methods oh yeah let’s go the next question is when should each variable
Conclusion:
The short answer is that computer science is not necessarily difficult if you have patience and determination. … Take your time, because being disciplined, methodical and patient become the most important skills in computer science.” Like any area of study, Computer Science is what you make of it.
PS: What you’re viewing below did indeed happen.