[Originally written on February 4, 2020]
Dear Eri,
Good day! I was quite too busy, so this letter’s late. I’ve been implementing a certain kind of architecture in a company backend app that I’m building from scratch. I don’t know your college curriculum, but before you learn any new language, you must know what IPO truly means: “Input Process Output”. It describes most of the systems in general. For example, I wanted grated cheese for my Filipino-style spaghetti: the block of cheese will be my input, the grating is the process, and the sprinkled cheese is my output. You get what I mean.
To visualise an IPO, you must visualise what you want, what to do to get what you want, and the things you’ll need to do what you want. Let’s say that you want to do a simple temperature conversion app; let’s be specific: from degrees Celsius to degrees Fahrenheit. Now, imagine three boxes of equal size. Line it up horizontally. In each gap, you place a rightward arrow. In the first box is your input, a temperature in degrees Celsius. In the second box, the formula. In the third box, the temperature in degrees Fahrenheit. A simple exercise. Draw it now on paper if you want. Visualise clearly.
After visualising the IPO diagram well, you’ll want to make a code. You see, most programming languages have a structure that can do the process in the diagram you just made… In OOP languages, you may call it a “method”, in most languages you call it a “function”. Those two aforementioned will always have these parts: the parameters, the processes, and the “return value”. Respectively, they’re the input, process, and output. (Although some functions lack either “input” or “output”; IPO is just a mental model, remember) Now, can you write a function in C++ or your preferred language? (HINT: it’s a separate block of code from the “int main” function). Call it afterwards. If you know your preferred language well, this will be trivial. Always read the docs or tutorials on the internet if you don’t know anything.
Most console apps (the ones you run from Windows CMD, Powershell, or Linux command line) have “arguments” or “args” inside a parenthesis written after the name of the function when you see their source code, especially in Java or C#; the program needs an input to run, and the output is usually an exit code, where any non-zero value signifies an error in the program. You must practise the use of consoles/command lines as early as you can in your college life, preferably that of Linux
I wish the best of luck upon you, Lucilla Eri.
Haytham Merger
No comments:
Post a Comment