May 25, 2024

My Journey Of Learning Programming Through Flatiron School #10

My name is Mason Ellwood, and I’m currently working on Flatiron School’s Online Full Stack Web Development Program. Each week, I’ll be writing about my experience, what I’m learning, and tips on learning to code.

While I was working through the Ruby course, I could not help question why they had started The Flatiron School in Ruby. I always had this idea that it was most beneficial to learn Javascript first then move to other widely used programming languages.

As the graphic above states, based on jobs needed and languages required, Ruby should be fairly low on the totem pole in terms of necessity to learn. Even at my last job none of the other developers knew Ruby….

So why does this course involve such an in-depth dive into Ruby?

The answer that I came up with is; beats me. So I did what any rational person did and jumped ahead and checked out the javascript courses. What I found was that there is not a huge difference between different OO programming language. Sure there is always semantics that makes a language unique. But for the most part, I can understand what most Javascript methods are doing without knowing a whole lot about Javascript. Once you know a programming language, most of what you know can be transferred to another. Then you just need to understand the semantics of the new language and how it operates, and you can pick it up fairly quickly.

I remember talking to my friend Wyatt. He was just hired on as lead project architect building software for a company with Ruby. I asked him how he was with Ruby and he said he had never used it…. But he said that he took a look at it and it java mixed with a few others and should be able to pick it up within a month. This is the conclusion I came to as well. Knowing your first programming language is the hardest part of becoming a programmer. Once you have mastered one, the others can come to you rather quickly.

Once I understood this, I was a little more content with the courses.

Iteration and Abstractions:

So there are four types of loops:

  • Loops
  • Times
  • While
  • Until

Looping occurs when you tell your program to do something a certain number of times.

Iterations occur when you have a collection of data (array), and you operate on each member of that collection.

“You don’t use three to four lines to express iterations, you use on word.” – Kent Beck

“Being abstract is something profoundly different than being vague… the purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise.” – Edsger Dijkstra

An iteration is a word referred to each step or each execution of a block. It is the singular execution of a sequence of code (we call a block) within a loop. Each yields elements one at a time to every iteration of the block.

The each method takes each element of the brother array one at a time and passes or yields it into the block between the do/end keywords. Each yield each item of the collection on which it is called to the block with which it is called. Each doesn’t need a separate counter variable and manual incrementation of that variable to know how many times to do something instead they use the number of items in a collection. The each method will always return the collection on which it was called as well.

So if you would like to iterate over an array and change some things, you will need to then pass that newly formed data into a new array.

Using loops and iterations are like the meat of Ruby. I feel like every lesson I have completed for the past week has been iteration after iteration. Once you dive into the code yourself, you will understand just how important these are to master and to be very familiar with.

Leave a Reply

Your email address will not be published. Required fields are marked *