I'm going to defend abstractions and I'm going to explain a way to build abstractions that seems to be counterintuitive to some.
Programming is building abstractions. If you are not not building abstractions, you are just copying and pasting code. It is very nice to be paid for something a machine can do, I mean, most managers do not understand the abstractions you can create and therefore they think copying and pasting code is fine.
And no, abstractions can be created automatically by a machine, at least not that I knwo of. Maybe using pattern matching they could. See for example condenser.
What are abstractions?
To abstract is to rescue some elements from a set, while leaving other elements of the set discarded as irrelevant or technical details.
Hopefully you have rescued the important or essential elements, that is the "what" as opposed to the "how". In other words, the intent rather than the mechanism.
Why is intent more important than the mechanism?
Because the mechanism can change, but the intent is usually a lot more stable.
How to build abstractions?
One way to build abstractions is to gather the universe in a concept (for example "universe") and then divide that concept according to characteristics. You can choose the charactetristics you want to divide the universe off, for example big and small, happy and unhappy, fast and slow. As you can see there is no happyometer, so there is a blurry line dividing the two sets.
But you could also be precise and say "everything that takes more than a second is slow" and therefore divide all the services you have implemented in fast and slow. But that second that is used as a dividing line is totally arbitrary. You could use 2 seconds because that is usually the attention span of most computer users, but I bet that number will get to 1 second in 2017. Why do I know this? Because 10 years ago 3 seconds were acceptable and some even required user interfaces to wait for at least 3 seconds or the user "would get too excited". That's totally contrary to what you would expect in the US, where users expect to get excited with products, but please bear in mind I live in Chile and here people have very low expectations about just anything (so users getting excited for the first time in their lifes is something unexpected and possibly could have deteriorating consequences on society ;-).
Another way to build abstractions is to forget about the universe and look at concrete things like a car, then look at a bicycle and then come up with a totally new abstraction: transportation.
Useful Abstractions
Are abstractions useful? Ask Larry Wall, the creator of Perl.
Abstractions is what make computers possible. Without abstractions, it is impossible to create a program, it is impossible to display characters on the screen (computers just have numbers inside) and all numbers would be binary.
Ok, but there is a saying "In theory, practice and theory are the same. In practice, they are different". I don't know where these people studied the theory of knowledge, but they should ask for their money back.
First, theory is just something you think, so if you think x and y are the same (in theory) then they are the same, but if you think they are different, they just are different (again in theory). So a self contradictory theory about x and y being the same and different is just a contradiction and it doesn't make it true. It is not even smart. It is just an irrational belief.
What abstractions are useful then?
First, for an abstraction to be useful:
1. It must not be self contradictory.
2. It must must be tested in a laboratory environment and be proved correct every time it is tested.
An example: Galileo predicted that without the air a feather and a stone would fall at the same speed. There is a video recorded on the moon that shows that that experiment was performed by the astronauts on one of their landings (or should I say moondings?). Guess what. Galileo was correct.
Another way to test a theory is to come up with a logical conclusion and prove that correct. For exmaple, the main reason astronauts got to the moon 500 years after Galileo predicted the existence of inertia, was that physics believed in inertia and they could continue to develop physics until Galileo was proved correct.
But the interesting thing was that Galileo was proved correct even before that, by Newton. Newton built a theory based...
lunes, 10 de septiembre de 2007
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario