<div class="gmail_quote">2009/4/15 Tony Hardie-Bick <span dir="ltr"><<a href="mailto:tony@entity.net">tony@entity.net</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">
</div>Recognising complexity (it has some very recognisable symptoms, even down to the<br>
way people talk about what they're doing, verbs, intonation, everything), is<br>
part of pruning the possibility tree and preparing the ground for a good<br>
solution. Simplicity is a wonderful goal; in code, electronics, maybe everything<br>
(music, surely), and choosing a simple solution, or waiting until a simple<br>
solution appears, is also a part of complexity management.<br>
</blockquote><div> <br>At work, I'm to write a server application that sends and receives SMS messages,possibly tens of thousands at the time. Obviously, sending out 12,000 messages from one application must not interfere with sending one message with a password reminder (which must be nearly instantaneous).<br>
<br>We've been talking about it, coming up wioth a design, ditching it, until we ended up with just a single, giant table for all incoming and outgoing messages. Configuration will be largely in the database, to enforce referential integrity. Making sure that transactions work properly ensures that you can cluster the application without a problem.<br>
<br>If one or more new messages come in, the application starts a new thread for each destination (which means a pool of connectiins to the SMSC, the SMS server). In each of those threads, the relevant messages are loaded from the database, and they are being sent to a thread pool (a Java 5 feature), the size of the thread pool being the size of the SMSC connection pool for that destination.<br>
<br>So we have one event starting one or more threads, each of those threads starting a number of threads themselves.<br><br>So there are dozens of threads running, but the whole thing can be described in two UML activity diagrams.<br>
<br>I thinlk it's actually a pretty simple design - and that's the sort of design I prefer.<br><br>- Peter<br></div></div>