User: Password:
|
|
Subscribe / Log in / New account

The platform problem

The platform problem

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.


(Log in to post comments)

The platform problem

Posted May 26, 2011 13:02 UTC (Thu) by Wol (guest, #4433) [Link]

Or, as I try to write code, address MY problem, but put copious comments and hooks if I think it's generic so the next person to come along (often me on a revisit :-) can extend the original code easily.

Cheers,
Wol

Abstracting commonality is a different skill

Posted Jun 7, 2011 13:13 UTC (Tue) by prl (guest, #44893) [Link]

I'll go further - the 3rd person in Neil's example needs to have a different skill set - that of taking in of the commonality and working out what's needed and abstracting and API at the right level.

The first developer is often the wrong person do this - not only because she's only working from one example. Someone new to the code can better analyse the code without the baggage of what the original developer might originally have had in mind.

As in our editor's case the new eye is not infrequently that of the original developer a few years down the line.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds