How do you learn a new platform/toolkit while producing working code and keeping your codebase clean?
When I know what I can do with the underlying platform and toolkit, I usually do this:
- I create a new branch (with GIT, in my case)
- I write a few unit tests (with JUnit, for example)
- I write my code until it passes my tests
So far, so good. The problem is that very often I do not know what I can do with the toolkit because it is brand new to me. I work as a consulant so I cannot have my preferred language/platform/toolkit. I have to cope with whatever the customer uses for the task at hand.
Most often, I have to deal (often in a hurry) with a large toolkit that I know very little so I'm forced to "learn by doing" (actually, programming by "trial and error") and this makes me anxious.
Please note that, at some point in the learning process, usually I already have:
- read one or more five-stars books
- followed one or more web tutorials (writing working code a line at a time)
- created a couple of small experimental projects with my IDE (IntelliJ IDEA, at the moment. I use Eclipse, Netbeans and others, as well.)
Despite all my efforts, at this point usually I can just have a coarse understanding of the platform/toolkit I have to use. I cannot yet grasp each and every detail. This means that each and every new feature that involves some data preparation and some non-trivial algorithm is a pain to implement and requires a lot of trial-and-error.
Unfortunately, working by trial-and-error is neither safe nor easy. Actually, this is the phase that makes me most anxious: experimenting with a new toolkit while producing working code and keeping my codebase clean.
Usually, at this stage I cannot use the Eclipse Scrapbook because the code I have to write is already too large and complex for this small tool. In the same way, I cannot use any more an indipendent small project for my experiments because I need to try the new code in place. I can just write my code in place and rely on GIT for a safe bail-out. This makes me anxious because this kind of intertwined, half-ripe code can rapidly become incredibly hard to manage.
How do you face this phase of the development process?
How do you learn-by-doing without making a mess of your codebase?
Any tips&tricks, best practice or something like that?