Recently I have learnt of the many benefits (including beautiful looking code) of OOP.
So, now I am trying to write a small physics API for my personal use, perhaps to be put in a few little games. This is mainly because I like to practice coding, and I like my physics.
But the thing is, many APIs have an interface like this (including the Windows API):
// In this case, Object is just a plain data container without a constructor.
Object object = NewObject(...);
DoSomething(object);
DoAnotherThing(object,...);
... and so on
Is this how APIs should be arranged, or is there are more OO-style way of things, like:
Object object(...);
object.DoSomething(...);
object.DoAnother(otherObj,...);
otherObject.attachNode(object);
... and so on again
I hope you get the idea. So, to summarise by question, which method is more prefered, and why is it that I see a lot of the first example despite the glorification of OOP (though perhaps these APIs in reference are just old, like the Windows API).
As a side note, what do you think of the Windows API? To me it seems just a bit... not right.