Tuesday, 31 March 2015

Abstract data revisited

I don't think I gave this topic much consideration, a passing reference at best I think, the abstract data type. The foundation for my intro to comp science course, it is how the house is put together on top of an existing foundation.

Back at the beginning of the course I didn't really give much thought to why this concept was so important. I could see how it worked, making a new data type that is specific to a group of programs that is a modification of an existing set of functions. This seems to be most effective when dealing with an object that has a set of common internal values like a flight that has seats, passengers etc. Before I gave this much thought I had moved on to object orientated programming.

Through the course assignments where we got to play with games I started thinking about the data type more. Being able to pack a bunch of reusable code in an object with properties that can be referenced is very helpful. It took a while for me to get my head transitioned from creating functions to creating methods. I am sure my life in this course would have been easier if I had come to this epiphany earlier. Guess that is the learning process.

This became a particular problem in dealing with the recursion of objects. I was constantly trying to pull the properties out of an abstract data type and forcing changes to them while passing them through recursive method calls. This turned out to be a very bad idea! Glad I have turned the corner now and now I let my abstract data type do the work for me. I guess sometimes you have to touch the stove when it is hot to know that isn't a good idea. Onward I go, putting my best abstract data type muscles to work in finishing off the course!


No comments:

Post a Comment