Entries in apps (1)

Sunday
Nov132011

I've Build... a Calculator!

Just as I expected there were more time to study and code after the 10th of November.  So, I went ahead and did one assignment from Stanford CS193 course on iOS programming and coded a calculator.  Now, I do remember coding one calculator in the past, but that was more of remembering the code rather than understanding the code.  This time I was able not only replicate what the instructor was doing, but go one extra step thurther and improve the original concept.

The calculator was supposed to be a usual one, supporting floating numbers and basic set of operations:  addition, subtraction, division, multiplication, and square root extraction.  It was very simplistic in both visual design and structural complexity.  Speaking of structure, though simple it quite well illustrates the Model-View-Controller paradigm, having three distinct classes:  CalculatorBrain (model), CalculatorViewController (controller), and the view which is build via Interface Builder in XCode.  While coding I've realized the boundaries between the three classes, and was even able to implement the extra features in the correct way, choosing the right class to modify!

My additions to the original app were just three buttons:  'AC' to reset everything back to 0, '+/-' to be able to enter negative numbers, and '.' to have the ability to enter floating point numbers.  It didn't take long for me to implement any of these features, but it surely provided a great experience and boosted my interest to continue with the studies.

I'm not posting any screenshots of the calculator here, because it's way too generic and frankly speaking looks ugly to me.  However, it served its purpose very well, and it even posed some design questions I really need to consider for my future apps.

I'm going to have a bit more free time during this week, so there will be more coding, studying, and hopefully great screenshots of my first apps posted here!