Ruby on Rails — Request/respond flow
Ruby on Rails was created to make a developer’s life easier by not focusing too much on configuration but instead on conventions. Rails is not a language but a web application development framework. This framework allows developers, including those who did not create the code, the ability to follow along easily if changes need to be made to the application.
Let’s discuss the request/respond flow: The client side makes a request in the browser. The receiving server sends the request to the router and the router sees the request. The rails router will send…
Using Private Methods
No one likes repetitive code. Repetitive code can cause errors and some may say that is causes your code to look messy. That is where private methods can come into play and can be very beneficial.
Creating private methods is a great way to refractor repetitive code. I am going to give a few examples of how private methods could have been used in my Sinatra project. Private methods could have been place in my entries_controller:
Get_entry & redirect_if_not_user methods can then be added in the private methods.
What is the scope in Ruby?
And why is it an important concept in programming.
Variables can be defined as place-holders and can be used to store data. Variables serve as a way of identifying data. For example, we can set name = x_variable. When name is called, x_variable will be returned because that is the piece of data that is being stored. This would allow for cleaner, safer code due to not having to rewrite the same code but instead just reference the variable.
Local variable, Instance variable, Class variable and Global variable are variables used in Ruby and…
CLI Application: The Set up
For our first portfolio project, we were asked to create a CLI application that requires several steps for a user to be able to get data. In other words, the user makes a selection & then given two options of how to obtain the data. Students could either use the scraping method or access the websites’ API (Application Programming interface). I chose option two, accessing the websites’ API as the method for retrieving the data.
The setup included creating various files, executable and environment file; and adding items to the gemfile. Within the environment file…
Why Software Engineering?
What is the percentage of people in the world that knows how to code? It was a question I asked and did not know the answer, so I searched it. According to the internet, only approximately .5% of the world’s population knows how to code. Now, I am not sure how accurate that number is because it was found in 2015. Although I do not know the exact number, I know it is a very small percentage. I thought, how amazing would it be to learn something that not many people how to do. How amazing would…