Day 2 of Java. With the help of my teaching friend, we are creating a calculator app. For someone who’s never programmed their calculator in middle school, it’s quite a feat. This a great exercise in how to start thinking like a computer. I drew out the layout of the calculator and started to define what exactly the buttons do, which is surprisingly cognitively taxing.
This is also a great time to start some naming conventions. One of the hardest parts of programming and code in general (in my opinion) is remembering the names of all the variables. This Pseudocode, a planning step, is a great time for calmly and rationally naming things. When I am rushed, I often name my stuff unintelligible ranty words like “bullioncube” and then have no idea what it means later. This was fun because I was visualizing how a computer thinks, while anticipating how I would think about it. You have to give everything a name, but in a way, that name has to be so logical that you will know what it does without having to look up what it does in your notes. That’s why I thought it would be good to name the first number entry as “column_A” because I think about adding like a spreadsheet, where Column A is the first thing and Column B is the second. But, there are no columns in this program.
Another example: In this program, the input value and the output value show up in the output screen. We named that value, “io_value.”
We realized that some of our functions are made up of sub-tasks that can be reused in other functions. It’s very satisfying to note where the sub-tasks are reused. It feels like less work and overall more elegant and sophisticated. More on that, it’s a logic puzzle, where it helps to be familiar with the concepts presented in Boolean Algebra. If/then statements become your best friend.