Guis, Processes, Threads, Simplicity - A Personal Manifesto
John Carter <[email protected]> Mon, 04 May 2009 15:23:44 +1200 (NZST)
| Newsgroups | gmane.comp.programming.language-of-the-year |
|---|---|
| Message-ID | <[email protected]> |
Simplicity is the price of reliability....
And I'm on a campaign to regain Simplicity and Reliability in my life.
I long while back I did battle with writing gui's apps and came to
this conclusion....
Unless the app is to be used by more than a 100 times as many people
than are writing it... it should be a command line app not a GUI.
Otherwise on balance life is more complex and buggy.
Recently I have wasted more time than I care to mention on the
intersection between threads and processes... and have written these
rules into my soul.
a) Prefer single process to multi.
b) Prefer multi-process to multi-thread.
c) A process may invoke a multi-threaded app (if it must), but
invoking "fork" from a multi-threaded app is too fraught with
subtleties. It can be done, but if you want it reliable... don't.
So here is my (current) list of "Yes you can do this, but you "Never"
should...."
* Never write a sort. The library ones are better.
* Never write (yet another) linked list implementation if
malloc/realloc will do.
* Never use a binary format if a human readable intermediate will do.
* Never write an editor. It'll will suck your soul, and then still suck.
* Never write an interpretor. Use a standard scripting language, they
are _much_ better, more powerful, well documented and less buggy.
* Never use XML unless it is the intermediate format for more than
one independently developed application. ie. You need "validate" to
assign blame for borkeness.
* Never write a GUI unless you have more than a 100 times as many
users than coders, or on balance you have made the universe worse.
* Never do concurrent anything if single will do.
* Never do multi-thread if multi-process will do.
* Never invoke process fork from a multi-threaded app. Yes you can,
but somewhere along the line you, your colleagues, or the libraries
you use will get one of very fine lines of fine print wrong.
John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand