"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."
Thursday, 1 September 2011
7 Ways to optimise Jenkins/Hudson
Tuesday, 26 July 2011
CQRS Queries (aka the read side)
Commands mutate state and trigger events which describe the changes which have occurred inside the write store. It is the responsibility of the read store to subscribe to these change events and update their read store appropriately (using event handlers).
All application queries from end users are made to the read store, which can be anything from a relational database to XML files. This data store is simply a thin read layer that's heavily optimised for reads. Each application's data view (think view models in MVC), typically maps to denormalised data tables rather than using joins (which slow down queries and prohibit scaling without headaches).
That's it, in a nutshell! The read side is a lot simpler than the write side of CQRS and something developers are more accustomed to. Working with denormalised data rather than third normal form makes queries quick and very easy to maintain; something for the junior devs :)
Consistency is over rated!!!
In a CQRS system, making a write does not immediately change what is read.
This is why CQRS systems are described as offering eventual consistency. CQRS evangelists question the importance of real-time consistency. They argue that by the time end users see data it is already stale. FOr example, requesting a data object via a web app results in a series of delays before the data can be displayed to the end user and hence is to a degree stale i.e. retrieving data from the data store, populating a DTO, returning data in a web response, page rendering in a browser.
I think I agree and if this is an issue for you, I suggest you question the importance of real-time consistency for your business. I'd argue that there is a time period/delta that for which in-consistencies can be tollerated and hidden from the end users. However, I do think that efforts should be made to keep this to a minimum and perhaps this delta should be actively monitored, especially for systems where it matters (e.g. a message system with high SLAs).
Monday, 25 July 2011
Command Query Responsibility Segregation (CQRS)
We've begun working on a new project at Esendex, one that involves making use of (amongst other things) the fashionable CQRS pattern. I've been asked to head up the project and over the past week I've read a number of articles and looked at some example projects. So far, I like what I'm seeing; an architecture for developing scalable, extensible and maintainable applications. It looks promising and if proven successful could be an approach we adopt at Esendex to pre-empt any future scalability problems that could result from our continued growth.
What is CQRS?
CQRS is an evolution of command-query separation by Bertrand Meyer. It works using Domain Driven Design where the behaviour sits in the domain objects; utilising DDD means the language used is important.
As the name suggests, the CQRS pattern separates out the objects for commands (for changing application state) and objects for queries (that expose the application state). This is quite a contrast to the more typical CRUD patterns that most developers (including me!) are comfortable with. Systems typically written as one, are split into a read side and a write side.
High level CQRS diagram ('borrowed' from another blog)
Confused?!
Expect follow up posts soon, in the mean time, here's some useful links:
- Greg Young (aka CQRS God) lecture video (6 hours+ long) and accompanying notes
- Nice example CQRS implementation in C# (by... Greg Young)
Sunday, 12 June 2011
Visual Studio Breaking on Exceptions for MSTests
Turns out I'm a massive idiot and I was just running the tests with the wrong keyboard shortcut - doh! Here are the shortcuts I was using and the ones I am now using:
Ctrl r + Ctrl t => Run tests in current context (debug mode)- Ctrl r + t => Run tests in current context
Ctrl r + Ctrl a => Run all tests in solution (debug mode)- Ctrl r + a => Run all tests in solution
Wednesday, 8 June 2011
T-SQL Simple Search & Replace on Table Content
This was thrown together in an attempt to save some time having to edit a hefty amount of text content. Simple amend the below script with your table, field, text you want replaced, what you want to replace it with and hey ho - you've hacked your content!
DECLARE @TABLE VARCHAR(30) DECLARE @FIELD VARCHAR(30) DECLARE @WHERE VARCHAR(100) DECLARE @FIND VARCHAR(100) DECLARE @REPLACEWITH VARCHAR(100) DECLARE @query VARCHAR(8000) SET @TABLE = 'MyTableName' SET @FIELD= 'MyField' SET @FIND = 'text i want replacing' SET @REPLACEWITH = 'new text' BEGIN SET @query = 'UPDATE ' + @TABLE + ' SET ' + @FIELD + '= REPLACE(CONVERT(varchar(8000),' + @FIELD + '),''' + @FIND + ''',''' + @REPLACEWITH +''')' EXECUTE (@query) END GO
Thursday, 26 May 2011
XP2011 International Agile Conference (Madrid)
The team at work had been discussing conferences and XP2011 came up, when I investigated the conference program it sounded promising; just what I'd been looking for infact. Add to the mix that it was in beautiful Madrid and I was sold.
Conference format
The conference is designed to bring agile researchers and practitioners together. The first and last days are dedicated workshops and tutorials for discussing hot topics in the world of agile. The 2 days between are the core conference days and the programme offers 5 parallel sessions; 3 focused sessions plus invited talks and reports from industry. They also offer time for OpenSpace on the Thursday, for attendees to create their own sessions/discussions.What was it like?
Good, very good. I wasn't sure what to expect to be honest, but the venue and food was great, people were friendly and everything seemed well organised. The session and workshop speakers were generally very good and knew their subject material well. You'd see the speakers attending lots of other sessions and discussions as attendees, they were approachable too, giving the conference that bit more of a community feel to it. Everyone seemed friendly, approachable and open to discussing their own agile perspectives and challenges they've faced; which I particularly found value in. One of the most enjoyable aspects of the conference were the sessions with lightning talks (10-20 min condensed talks). The speakers that I found particularly interesting were Ken Power, Esther Derby, Emily Bache, David Anderson, Mike Hill and Liz Keogh. Expect to see some posts related to the more interesting topics I attended at the conference over the coming weeks.The social events were also well organised and there were plenty of complimentary drinks and food for everyone. The Wednesday night geek disco was a particular highlight :)
Any complaints? Well, a few of the sessions based on research papers were presented by the researchers themselves, who seemed a little inexperienced at presenting and as a result the session wasn't enjoyable. You can have the most interesting material in the world but if you don't deliver it well, you don't engage me or the rest of the attendees and it's a bit of a waste of time.
Conclusion
I enjoyed it and I'd recommend it to others looking for a conference of this type. The attendees are passionate about the subject matter and it's infectious. If the subject material for XP2012 (Sweden) grabs me, I may well return to satisfy my agile appetite.Monday, 16 May 2011
Getting to grips with Git
- clone - get the source code from your remote git repository
- Make your changes
- commit - commits your changes LOCALLY (not the remote git repository)
- push - commits your changes to the REMOTE repository
- clone - get the source code from the remote git repository
- branch branch-name - create a branch branch-name
- Make your changes on your branch
- commit - commits your changes LOCALLY (not the remote git repository)
- push origin branch-name - commits your changes to the REMOTE repository
- checkout master - switch to the master branch
- merge branch-name - merge the feature branch into the master
- commit and push !!!
At the moment I'm still working with the bash but I occasionally use TortoiseGit for windows explorer integration and Git Source Control Provider for Visual Studio GUI integration.
Sunday, 20 March 2011
jQuery Document Ready Shorthand
You should always start your jQuery using the ready() function. The handler passed to .ready() function is guaranteed to be executed after the DOM is ready.
There are a few ways to start your jQuery function, but all are equivalent:
$(document).ready(function() { // Do some magic }); $().ready(function() { // A bit quicker to write }); $(function() { // Nice shorthand that I prefer to use });
Tuesday, 15 March 2011
jQuery Sytax Error - Unrecognized Expression
A recent upgrade to jQuery 1.5 from 1.2 highlighted a problem with jQuery expressions which resulted in a number of javascript errors...
Syntax error, unrecognized expression: [@attributename=value]' when calling ...
Some digging highlighted that attribute selectors, since jQuery 1.3 and above no longer use the @ syntax. This actually had been deprecated since version 1.1.4, but only from version 1.3 is it no longer supported.
Old way (pre jQuery 1.3)...
$("#holder input[@value=contacts2]");
New way (post jQuery 1.3)...
$("#holder input[value=contacts2]")