How do you learn a class hierarchy quickly?
.net, programming-languages
Solution
I was in your position as well long time ago when I learned Java and its Collection classes (or SWING, or AWT for that matter).
Here are a few steps I did and the outcome of those steps:
- Didn't bother to take notes, keep on using it => only remember the most used class
- Take an unorganized notes => same result, remember the most used class
- Simple class diagrams => improvement, but incomplete
- Simple class diagrams but complete with sub-classes organized it per component (package in Java) => Jackpot!
Few more advises:
- Eliminate deprecated classes
- Find a symbol to mark a class is thread-safe (put a TS or something)
- You could omit the least-used sub-classes (maybe) as you go along with your adventure
An example of a simple class diagram:
- http://www.ged.fi/DesignPatterns/AWT.gif
- http://www3.ntu.edu.sg/home/ehchua/programming/java/images/IO-input-output-streams.png
Compare to this (not-so-simple):
- http://www.owlnet.rice.edu/~comp212/08-spring/lectures/30/reader.png
Hope that helps.
Ed
Problem
Something I don't enjoy about programming is learning a new API. For example, right now I'm trying to learn Windows Identity Foundation. Its frustrating because I'm going to spend the bulk of the time learning how a few classes work and actually only write several lines of code. In .NET, there are so many types that I seem to spend more time hunting around in msdn for a class than writing code. It also interrupts my workflow while I'm working because I have to type a little bit than look something up. Obviously, I don't have to do this for the basic classes. Whenever new things come though there is definitely some looking up to do. Then I often don't reuse that class enough to really review it or bring it into action. I'm wondering if anybody out there has a found a way to memorize (or look up more efficiently) these object model hierarchies?