Tutor profile: Jose R.
Subject: Software Engineering
There are times in programming that you find your self writing the same lines of code over and over throughout a program. Can you give some examples of programing concepts ideas or best practices, which help significantly reduce the need of repetitive code within a program?
Among others, I find that there are actually a few ways for which this can be achieved. One way is exercising the different types of loops most programming languages are capable of doing such as Java, C# or Python to name a few. Loops which include "for" or "while" loops. The least obvious way though, is by utilizing functions or methods. Creating a method / function once allows the programmer to reuse already written code so that it is not repeated through out the program. This allows for the programmer a single point of entry if there ever is a need to change something about that particular piece of code and that change would automatically allow other part of the program that utilize said method or function to be essentially updated with the proposed change automatically.
Subject: Computer Science (General)
In computer science there are basic fundamentals for which one need to be familiar with particularly in programming. But taking a little step back , before programming even happens what must be done first?
In computer science one needs to become familiar with the ability of looking at a problem or concept and breaking it down into its building blocks. It's more than just writing code. If presented with a problem you first ask questions in terms of how many, what is the limits and what are the various scenarios , what are we trying to accomplish. It is then, when the problem or task is broken down and comprehensively understood, that's when programming or coding can begin.
You find yourself in a movie theater with 22 of your of your best friends. You have no idea how much are the movie tickets, but everyone. Everyone gave you a 5 dollar bill so you can pay for everyone's tickets while they all go in to find a seat. You go ahead pay for all the tickets by handing all of the money to the teller and you get back change without even asking how much is the tickets. The teller gave you back 23 dollars. How much were the tickets? You have pencil and napkin , can you quickly find me an equation that can help us figure out your equation. Explain.
So I have 22 friends and they each gave me 5 dollars to pay for the movie. So the overall cost would be 23 * 5 = (cost of tickets) - 23 because you got back 23 dollars back. The order of operations allows us to see that the cost of the tickets is 92. 23*5 = 115 - 23 = (cost of tickets) = 92 ... but thats is the over all cost we want the actual cost of each ticket. So we know that, I have 22 friends plus myself is 23 . 92/23 = 4 . That means that each ticket was actually 4 dollars.
needs and Jose will reply soon.