Re:Happy with incomplete understanding of API provided your ...
by 10ren on Monday March 23, 2009 @08:31PM
(#529469)
If you're using an API all the time, it's easy to justify investing the time in understanding it to the next level.
API defines an abstraction - I assume you're askng about understanding that abstraction completely, not the specifics of how it is implemented. An abstraction can include changes of (abstract) state, and it can include performance characteristics/gotchas (as in Joel's "Leaky Abstractions").
An API can be designed for learning, by forming a series of nested abstractions, such that you can completely understand each well-defined subset independent of understanding all the other subsets. Perhaps an example is a String object in Java or Python. Understanding creation and assignment is a completely self-contained subset of its functionality, without using any of its methods (as such). A deeper level of understanding includes performance characteristics.
To answer the question: I feel I must understand the subset of the abstraction that I am using, in order be confident in the correctness of my code.
But many APIs are not designed this way. Designing APIs for usability is hard, and most programmers prioritize features, performance and internal elegance over it. I suffered to write this. Now it's your turn.
And, worse, the implementations of many APIs have bugs (well, all of them do). It's just that more users find more bugs, so more popular libraries usually have fewer bugs (in their mature parts).
I find a constant pressure between writing the best possible code - and getting things done (one advantage of getting something done is it puts you at a vantage point where you can see more - and becoming part of the process of understanding).
API defines an abstraction - I assume you're askng about understanding that abstraction completely, not the specifics of how it is implemented. An abstraction can include changes of (abstract) state, and it can include performance characteristics/gotchas (as in Joel's "Leaky Abstractions").
An API can be designed for learning, by forming a series of nested abstractions, such that you can completely understand each well-defined subset independent of understanding all the other subsets. Perhaps an example is a String object in Java or Python. Understanding creation and assignment is a completely self-contained subset of its functionality, without using any of its methods (as such). A deeper level of understanding includes performance characteristics.
To answer the question: I feel I must understand the subset of the abstraction that I am using, in order be confident in the correctness of my code.
But many APIs are not designed this way. Designing APIs for usability is hard, and most programmers prioritize features, performance and internal elegance over it. I suffered to write this. Now it's your turn.
And, worse, the implementations of many APIs have bugs (well, all of them do). It's just that more users find more bugs, so more popular libraries usually have fewer bugs (in their mature parts).
I find a constant pressure between writing the best possible code - and getting things done (one advantage of getting something done is it puts you at a vantage point where you can see more - and becoming part of the process of understanding).