Wednesday, December 28, 2016

Systematic Program Design - Part 1, Sec 2

If you've been following along on this journey so far, you probably know what to expect from this post. I finished section two today (I think it's referred to as module two, but w/e). Much of the content has been a form of review for me again, but I think it was still worth going through. Again, I smashed through all of the video lectures at 2x speed. At that speed it took me about 5 hours to complete basically all of the content. I'll be fair here and note that when I say basically all, I mean I did all of the code work, but I didn't write down every step.

This section really tries to drive home the importance of laying the foundation, before writing a function, by strictly defining the data you'll be using and how you'll be using it. I'm cheating a little bit, in that I don't write out every detail. Also, because I'm coding all of the problems in Visual Studio, instead of DrRacket, I can use XML Commenting to describe the data for my function and even provide documentation through IntelliSense when I go to use that function elsewhere in my code.

If you've never used either, the documentation for a function in DrRacket - using the style taught in this course - might look something like this:

;; Time is Natural
;; interp. number of clock ticks since start of game

(define START-TIME 0)
(define OLD-TIME 1000)

#;
(define (fn-for-time t)
  (... t))

;; Template rules used:
;;  - atomic non-distinct: Natural

While in Visual Studio you might do something like this:

/// <summary>
/// Given the current game time, this function will provide the elapsed time,
/// since the start of the game.
/// </summary>
/// <param name="currentTime">This is the current game time.</param>
/// <returns>Returns a TimeSpan indicating the elapsed game time.</returns>
*/
    private TimeSpan GetTimeSinceGameStart(DateTime currentTime)
    {
         // TimeSpan gameDuration;
         // ToDo...
         // return gameDuration;
    }
/*

Note that I don't follow the exact same pattern emphasized in the course. Because I don't follow the same structure, or maybe better said, because I don't put 100% effort in, I won't be getting 100% return on my education. I don't suggest you follow the same path I've taken if you're still fairly new to programming.

Overall, this section was time well spent. I got to practice writing definitions for functions, and I got to look at very thorough examples of a proven technique to design data definitions. I also learned some new vocabulary (not necessarily new concepts) to talk about data definitions, like Simple Atomic Data, Interval, Itemization, Compound Data, etc., and gained some insight into the number of tests appropriate for functions using different kinds of data.

It's really important, in any field of work you choose to go into, to understand most of the vocabulary used by professionals in that field. Often times seemingly simple words can carry a ton of information, and it's important that everyone can communicate with common words to their industry, in order to transmit ideas efficiently. I've always loved expanding my vocabulary, because expanding your vocabulary, often means expanding your understanding of new concepts.

No comments:

Post a Comment