Specialising…

It is funny, I was chatting to somebody yesterday. The subject was the specialist skills that she had gained during her education, and subsequent working life. Well, they seemed specialist to me – I do my best to follow but sometimes it is difficult to keep up.

We finished the conversation with me saying that I would need to talk about my own “specialist” skills one day, so maybe today is the day to start?

In my first job, I did some computer programming. When I started, it was just making small tweaks to programs written by other people. The program would do this, then this, then this, then this, etc. All very much like an ordered list, if you have ever come across them. (WordPress lets you create ordered lists in your posts.) I later learned that this type of programming had a name – procedural programming. Because it was a procedure. Do A, then B, then C etc. One thing after another.

I was still quite a novice in this environment when I was asked to get involved in another type of project. The first one had been quite an advanced simulation – lots of physics coming into play. Very theoretical. The next project was far more practical – controlling things. Move something six inches along a track, by way of a computer program.

In fact, I had been dropped into an object-oriented (O-O) environment, though at that stage I didn’t appreciate what object-orientation was. More about object-orientation in a moment.

That first object-oriented project was a challenge, because I was trying to apply my A, B, C knowledge to an environment which didn’t really fit. These days, I look back and cringe. I guess most of us do when we think about the messes we created at the very start of our careers! Retrospectively, I was probably in the best environment possible, simply because I was given the time and space to learn and to actually become very good at object-oriented development, but at the time, the learning curve was very steep.

So, what exactly is object-oriented programming? Well, actually, it is a deceptively simple approach. You see things as a set of “objects” which interact with each other, to get the job done. Just like in the world outside our windows. Objects? Well, imagine a car, say. A car is an object. Anything can be an object. Within our idea of a “car” we can say a few things. The car contains four other objects, called wheels, plus another object, called an engine, one called a steering wheel, and so on. And you can do things to it, like “drive” it, or “stop” it. All real-life things. So, easy to visualise how something hangs together.

So, you have your world full of these objects. And each object does it’s own special job. If I were to get into a car, and drive off in it, to be honest I have no idea how it gets anywhere. What happens under the hood, I leave that to a mechanic. If it won’t go, I am stuffed – I leave that to a machanic.

And it is exactly the samewith onject-oriented programming. The “car” does not know how it moves, but it has an engine, and that does! In the same way, the engine can hide all the mucky bits away – the oil, the petrol, the spark plugs etc. All the car needs to know is how to drive the thing! In the world of O-O, we call this encapsulation.

Then, you look up and down the scale, not just at the car. Looking in more detail, we can see a wheel, which has tyres and so on. And, looking instead at the bigger picture, what exactly is a car? It is a motor vehicle. An engine, four wheels, a steering wheel….. Just like a bus or a truck. They all get us from A to B. Okay, they’re all a bit different from each other, but there’s a lot in common. Just recognising these similarities, we call specialization, or inheritance.

In fact you can go even further up and recognise that these motor vehicles are themselves just special cases of a vehicle, which might include a pushbike, say. Or, think of a motor bike – just two wheels, but still a motor vehicle. So do you see a kind-of tree forming? Where everything fits snugly into its place? At the trunk you’re very general, but your description covers many things, whereas as you proceed out to the tips of the branches, you gradually split off and become more and more specialised.

And that’s really 90% of the way there!

But you can imagine these trees can become quite complex. You can imagine, with a car, you’re talking about thousands of objects, from the tiniest nut or bolt, to somethind like the chassis. And that was my job, though not with cars – to look at a particular problem and work out what the tree looked like. It was one of those things, I got into it because I was good at it, at seeing similarities, at pinpointing differences, but believe me, a lot of people just don’t see the world in this way.

Shall I try to push it just a little bit further? You drive a car. You drive a bus. You drive a truck. What’s the difference? Okay, there’s a small difference in each, but fundamentally, you’re putting your foot on the gas, and <whatever you’re driving> goes from A to B. So, in fact, the act of driving the vehicle is pretty much the same in each case. We have a name for that too – the most complicated name of the day, because it comes from Greek. We call it polymorphism, which literally means many forms. But don’t worry, I’m not going to test you on any of this!

But would you like a little homework? Look again at my featured image, and tell me what’s wrong with it πŸ™‚.

Author: Stroke Survivor UK

Designed and developed IT systems for banks, but had a stroke in 2016, aged 48. Returned to developing from home, and have since released a couple of apps. I split my time between this and voluntary work. I am married, with a grown-up, left-home child.

11 thoughts on “Specialising…”

  1. Ok, my guess is that the word ‘piano’ needs to be in a rectangle? What a fun post, I was thinking and imagining it the whole time. It’s like gymnastics for the brain! So when you have an object, that exists out of other objects (or smaller possibly similar categories) which on its own exists out of other categories. When everything work together there is a ‘take off’ but otherwise there is a problem.
    But to translate all that into a computer language you must be very clever. Did you develop the programs or were you a wizard with them?
    Now I’m wondering how a toy car with a remote control works …

    Liked by 1 person

    1. Of course! Brain the size of a planet…(sorry that is a computer joke (unless you ever read Douglas Adams. If not, I can recommend him. Even just his quips and quotes online are brilliant.)
      Object-orientation is pretty common now but it adds a bit of bloat. Mostly, nobody worries about it, but you might if you needed to be mega-fast, or had limited physical space, such as miniaturization. I suspect the circuit board in a toy car has got next to no storage space on it.
      The diagram, btw. I would see an Instrument box at the highest level, then maybe boxes at a second (new) level – string instruments and percussion instruments. (I found that a piano is considered to be a percussion instrument). Then, when I come along with my violin, I know exactly where to put it!

      Liked by 2 people

      1. No way, a piano is a string instrument! It is a category on its own, what with the harp and the harpsichord? I think figuring out all the levels isn’t that easy but interesting. I follow a blog on WP about object-orientation. It is very interesting.

        Liked by 1 person

    1. Funnily enough, there are proper conventions for design diagrams, including not just which way the arrow goes, but how the arrowhead is filled in (open, closed etc.). But the image above doesn’t conform to any standard anyway.
      If it were me (this stuff is all arguable, so “wrong” was a bad choice of word), I would have a top tier Musical Instrument, as the diagram does already. I’d then add a second tier, percussion instruments and string instruments, and have guitar and piano dangling off those. I know piano is normally considered a percussion instrument, and I assume a guitar is classed as a string instrument. It’s just that, when I come along with my violin, it is abundantly clear where I need to stick it. If you’ll pardon my expression πŸ˜†.

      Liked by 1 person

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.