Object Oriented Programming is, in my opinion, is simply a useful tool. However, I disagree with the idea of us being taught OOP from the very first courses in high school and university.
OOP is a method of organizing code into logical units called objects. Objects are supposed to reflect actual real items, ones which we would like to poke, and be able to observe. An object knows everything about itself, all the data that determines what it is, and an object knows how people could interact with it. However, it is a black box in how it manages to respond to our pokes. If we ask a table to record a value, how it stores that value does not matter to us, all we need is a key to later retrieve it with.
OOP has its benefits. It makes designing our code closer to the way we design actual objects. If we were designing a box, we would have a way to put things in it and take things out. So we makes those methods. The box also need to contain whats in it, so when we move the box, we move whats in it. So we give it that field. This is intuitive to think about, and we abstract away from the machine underneath our code.
However, I believe this is not the right way to learn computer programming. While it is an easier and more intuitive way to write code, I believe that writing code without an understanding of what goes on underneath in the machines most basic actions is not entirely correct. While I am not saying one should start programming with machine code, or with assembly, I believe a low level language like C would be a good place to start, and make the basic concepts behind a running program more accessible to delve into from that base, letting us understand the structure behind many things, such as abstract data types, the idea of linked lists, how memory is managed by the computer and our operating systems, the speed of specific operations done by our computer, the troubles of floating point arithmetic, and all these concepts that an OO interpreter takes care for us and we take for granted.
In a way, OOP is a way for the programmer, a translator between normal language and computer language, to think closer to our normal physical world than the world of binary digits and manipulations of 0s and 1s.
That's an interesting idea. Perhaps you are right, for many people it might be useful to learn how a computer works before starting to code. Learning C would give you a good idea of that. But starting with C is very difficult. You have enough to learn with the various loops, recursion, OOP, data structures, big O notation, etc. without adding pointers and detailed memory structures to the list. All in good time :) and you can always learn it in your spare time.
ReplyDeleteI actually started learning computer science from plain C, and I did enjoy it. Granted, it was like you said, the program started with the basics, loops, recursion, data structures, and then only moved on to working with pointers and building on memory structures. However, the course kept the idea of organizing computer memory in the background while learning the more basic concepts, so I feel like the when managing memory was formally introduced, it was slightly less foreign to me than if it was left in the dark when discussing the simple built in data structures.
ReplyDelete