Talking about a class library is a great way to kill a dinner party or put someone to sleep! It’s one of those things that we all understand without realising we do; its everywhere but nowhere. It’s also really detailed work and time-consuming to do properly so it’s often ignored.
So what is it?? It is the definition of all the types of “thing” in your world. We use them all the time when we talk about “Computers” or “People” or “Work”.
There are three main sorts of Class: “Abstract”, “Physical” and “Functional” (yes there are more but lets keep it simple for now!).
Why do we need them? Well, as humans we spend most of our time talking about Abstract and Functional classes. For example, a “Car” is an abstract class. What do you mean I hear you cry! A car is a real thing!. Yes, instances of cars do exist but you can only buy a very specific instance – you can’t buy a generic “car”, you can only buy a Ford Mondeo LX or a Bugatti Chiron; these are the “Physical” classes – real objects you can touch.
Functional classes are like roles that are performed, for example a car journey, or “the shopping”, or a flight. You can’t touch the “flight” but we all know what it is; you can give it a number and buy a ticket for it. It has a departure time, destination etc. It’s carried out by the physical instance of the aeroplane.
We need a class library so that our applications know what sort of objects they are dealing with and therefore can expect them to have certain properties (of know datatypes).
A well structured class library allows you to build applications that are portable across different assets. They overcome the problems of different naming conventions across assets or sites.
You can also add new classes overtime and create subclasses which, when combined with multiple inheritance, gives us our all-important flexibility.
Do get in touch if you want to talk more about data models and class libraries (or if you have insomnia;).