Tuesday, February 16, 2016
I like to think of computer programming as trying to solve a bunch of smaller puzzles until the big puzzle is finished at which point it becomes a machine for doing something. Granted I have only gone into object oriented programming languages so this perspective may change with time. To clarify, object oriented programming is taking things called objects and making them do things. Objects are essentially packets of information. At their simplest they may be integers or strings of characters. As they grow more complex, they may be packets that hold multiple decimal numbers and/or groups of information called arrays. Objects can even contain other objects. Say I have an object that is an integer called "n." Say we make another object that needs an integer and string of characters. We'll call this new object obj1. We give obj1 our integer object "n" and a string of characters called "s." We can then make a new object called obj2 that needs an obj1 object and a decimal number. What each of these objects does is entirely up to the programmer and this is where the puzzle solving comes in. The programmer has a goal set in mind for what the program is meant to do. It is up to the programmer then, to decide what objects he needs, what each object is going to do, and how that impacts the rest of the program. There are also expectations for writing a program like making a program open to expansion but not modification meaning that someone can come along and take your code and use it for new objects without having to change your original code. Say I want to add two plus two. Such a program is incredibly each but what if I want to add more than just two plus two. what if I have to add 3 plus five. Beyond that what if I want to multiply using my addition program.