Sunday, 19 January 2014
Week 3: Object-Oriented Programming
Object-oriented programming is a way to write code by creating your own types for the objects you create, via classes. These types are designed to make an object store data in the same way that object stores data in real life. The type for an object that was made through a class is typically a combination of types that are already built-in to the programming language. For example, In CSC108 last semester, we practiced with a class called "Day" in python. The type of a "Day" object is a combination of 4 pieces of information: day, month, year, and events. In specifically this case, day and year are integers, month is a string, and events is a list. Any of these pieces of information can be called to in a very visually-friendly manner, and I think this might be the reason why we like Object-oriented programming so much and why we're supposed to get used to doing a lot of it, especially in our larger, more complicated programs.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment