Friday, June 16, 2017

Unions Structs Enums - Easy as Goo Pie

This was really an easy chapter for a change. Many things learned from previous chapters have come together here, making the task of writing code for the fifteen Programming Challenges almost a breeze. I can't say that i am totally satisfied with the totality of my work. There was a number of at least three to four Challenges, that, by putting a little more effort into writing code to solve them, the solutions would have turned out to be way better than I feel they are. The reason is this.

In chapter ten, which was all about strings, string objects and C-strings, I wasn't too sure whether it was worth doing it. Much less what good it would be to learn about such things at that point in time. After being done with this chapter, which involved to put into practice some of the techniques learned from this chapter, I know what it was good for.

Programming Challenge 11.8 - Search Function For Customer Accounts is a very good example. It contains numerous string objects holding date, names, addresses etc., crying out loud for some more in-depth input validation. For the date alone, some of my visitors may have visited Programming Challenge 10.19 - Check Writer which includes a header file for validating the dates. That alone makes for at least 200 lines of code. While it might have been possible to use the include file in Challenge 11.8 as well, it would have still been not enough. What with the names? What with upper- and lowercase for names, and changing the case? 

I was seriously considering it for a while, then, ultimately decided against adding another four to five hundred lines of code to cover every possible input or upper-lowercase error. It is pointless to waste time thinking about what could have been. While my wish to write code as complete as possible, sometimes going above and beyond what has been asked for, my will was not strong enough. I reasoned that it is ultimately just a demo, and that it shouldn't matter to me that much. The important point is: as long as the key points are covered, and no logic or other errors are present, and the program is working as expected, everything should be alright. 

Long story short, this is the reason for my dissatisfaction, not only with Challenge 11.8, but also with some of the other solutions. Summarily I can say that this last chapter was a good precursor for classes, which, unfortunately is not what the next chapter is going to be about. Chapter 12 deals with Advanced File Handling, which I feel will be utmost useful to learn about. 

This being a very small chapter summary, as there really is not much to write about that I can think of, I can't wait for things to come, my knowledge to grow and the weather to become more 'Sitting-In-Front-Of-PC-Trying-To-Write-Code' compatible. With this I wish all of my regular readers, visitors, and of course my fellow learners a good morning, start into your coding day, or a very good rest for the night, after hours in front of your PC, trying to write good code.

No comments:

Post a Comment