Q: I’m just getting into programming and have been doing some light reading online about object oriented programming. I was hoping you may be able to explain a bit more clearly what classes and packages are ?

A: Essentially, classes are the blue prints for the objects you create in code. As an example a button can be classed as an object, so you would use a class file to outline how that button may look, such as it’s width and height dimensions, and how it should re-act to certain events, such as mouse clicks or mouse overs.

Most OOP programming languages allow you to sub-class an object. So say for example you have your button class coded and ready to go, but you then realize that your application needs more than one button, and each button has a different task to perform. Rather than re-creating a new class file for each button you can create a class file which will inherit all the properties of the original but also allow you to add extra functionality as required for that particular button object.

Packages are essentially directories which contain a group of related class files. Going back to the button analogy, if you can imagine that you have one class file which contains how your button should look, another to describe its events and yet another to describe how it should re-act to those events, it makes sense to have these files stored in a single location so they can easily be re-used when ever you need them and that is what packages are for.