Back in freshman year, My professor wrote down five things onto the whiteboard and told us that we needed to understand these concepts. These were the fundamentals of computer programming. No matter which language you learn first, or decide to migrate to, you will be able to solve any programming problem by simply implementing these fundamentals.
-Take input
-Allocate memory
-Give output
-Make decisions
-Loop
Take input is often the first fundamental taught when teaching students. This could be something as simple as creating a console application and prompting the user for a number as input. Many languages have different ways of taking input. With Java, you can use System.in.read() (don't forget to flush the keyboard buffer) or the scanner class. In C#, when dealing with console applications, you'll most likely start out using console.ReadLine(). Different methods, same concept.
Allocating memory is usually the next step when it comes to taking user input. After a user enters input, depending on the type of input it is, the program may need that user's input in order to process it later on. For starters, the user input will most likely be stored into a primitive type such as an integer. Later, user input can be stored into objects such as strings. Once programmers become more advanced, they can then start to allocate user input into more complex data structures such as Trees or Lists.
Giving output is simply displaying information to the user that is easily digestible. Maybe you are building a calculator application and need to display the results. Maybe you've created a complex algorithm for your fortune 500 employer and need to display the results into a data table so non-technical folks can easily digest it.
In programming, there are a lot of decisions needed to be made by the developer. When a developer wants the program to make a decision, they will need to incorporate if-else statements that will allow the proper decision to be made. Senior developers tend to use ternary operators and nested complex statements that tend to obscure the logic for the juniors, but that's what comments are for. At the end of the day, fundamentally, these statements come down to basic if-else statements.
Looping is one of the most essential concepts juniors should familiarize themselves with. Need to access data of an array? For loop. Need to create a chessboard? Two for loops. Need simple input validation?
While( input != null ){
}
Looping can be simply taught, however, when complex problems start to arise, that's when certain loops become harder for juniors to understand. Don't fret, in order to run you must crawl. If you can understand how a for loop allows the program to access all elements inside an array, you'll be able to understand how a foreach loop can allow the program to access all items inside a Model inside an MVC application.
In Coder Foundry, we were tasked with creating minisites that will allow us to complete coding challenges and display results to the user. In order to complete the FizzBuzz mini-site, I needed to revert back to the 5 concepts. The program will take two inputs from the user and allocate them as integer data. Next, loop through all numbers between 1 and 100. Print "Fizz" if the first user input is divisible by the number that is currently in the iteration, or "Buzz" if the second number is divisible by the number inside the iteration. Otherwise, just print the number itself.
Making decisions is usually the hardest part for students to understand because it involves algorithmic thinking. The FizzBuzz application makes decisions based on the else if statements.
Lastly comes Giving output. The programmer will need to give output in a way that is easily digestible for other programmers and non-technical clients viewing the program. For this specific project, I created a table class in markup, and then manipulated the data (Making Decision and looping) in order to display the results properly to users.
From personal experience, I've gone from Java, to C++, to C, and now C#. Syntax differences will sometimes get in the way of things, however, strong programming fundamentals will always allow developers to keep a level head and understand complex problems by analyzing which of the 5 concepts need to be implemented and at what point in the program.
Click the link to view the project:
https://zacharyhadjahfizzbuzz.netlify.app
Top comments (0)