Posted May 20, 2011 0:13 UTC (Fri) by neilbrown (subscriber, #359)
Parent article: The platform problem
I think this has been touched on indirectly and with different words by other commenters, but I think it is still worth saying...
I think it is important to remember that you cannot reliably generalise from a single example. When you try to write 'generic' code to meet a particular need you may well find out that the code isn't actually useful for anyone else.
I think the best approach is to write your code like a library but don't push it into the 'common area'. Then if someone else has the same need they can copy/paste your library and make it meet their needs. Then a third person can see both proto-libraries, decide that there really is a lot of commonality there, and create a real library in a 'common area' and modify both old drivers and their new driver to use this new library - which is now generalised from three examples, not one.
Of course this assumes two important preconditions:
1/ developers look at other people's code for ideas before writing their own.
2/ The subsystem is structured to allow common functionality to be provided by optional libraries rather than a mandatory midlayer.