Wednesday 20 July 2011

Rapid Software Architecture Design Tools

In an ideal world you'd want design the system architecture first, then program in conformance to the architecture design. Back in University I used tools such as Rational Rose for modelling UML class interaction diagrams. This was great to be able to detail in what classes you've decided to use post-design and to get a good mark from my tutor. But, for the actual design process it was slow, unintuitive, boring and a pain to deal with. Pen and paper for rapid prototyping was my best friend in discovering the best architecture to go with.

Now say hello to the world of cutting edge software, where new system constraints are being discovered as these systems are built and interact with each other. You end up constantly re-designing your architecture to fit in with these constrains, which means the actual step of modelling your architecture on a tool such as Rational Rose becomes a fad.

When modelling your architecture becomes a second thought, you lose the ability to effectively communicate to other developers and project managers how a system works and what the cost would be of developing new features to the software. This is bad. There has to be a better way.. What we need is rapid software architecture design tools.

So in this effort to discover such a tool, I've shortlisted the following tools for trialing.
  • Microsoft Visio (Windows, commercial)
  • yEd (Windows/OSX/Linux, free)
  • GraphViz (Windows/OSX/Linux, free)
  • Dia (Windows/OSX/Linux, free)
  • Visual Paradigm (Windows/OSX/Linux, commercial)
  • Enterprise Architect (Windows, commercial) 
  • OmniGraffle (Mac, commercial)
Now remember, the use case of this tool is to re-architect systems more intuitively than using a pen and paper. I will be very harsh in my scoring, as I will be comparing these tools to using a pen and paper.

Microsoft Visio 2003
I'd heard great things on this tool. Firstly it's the recommended tool of choice as my company has a license for it, mind you it's only a licence for the 2003 edition. Now, I really really hope they've improved on it since then because using this tool is like having your eyelids pierced while watching a Justin Bieber music video. It is so UGLY. UGLY to use, UGLY to look at. The lines are rigid, the connection sections stand out too much, a dialog box pops up just to rename a class. Even if I managed to model the most intricate architecture in the world ever with this tool after years of practice, if I showed the results to someone, they'd probably stab their eyeballs out as relief from looking at this monstrosity.

Score: 0/5
Please don't use or recommend this software.

yEd
I'm using the mac version and it looks and feels pretty dated. I don't understand why the class boxes don't resize if you give them a name that doesn't fit the box. Panning is unintuitive. Creating arrows is a mystery, and it seems to like creating classes every time you left click the mouse. Well, at least it's nicer to look at than Visio.

Score: 2/5
Has potential, may come back to using this later.

GraphViz
I've kind of used this tool before when generating a DOXYGEN, well not really. The doxygen tools generated the chart automatically and I did nothing. My gut tells me that this tool will be useless unless you're a command line VIM junkie.. My gut was right. I have no idea how to use this tool to create charts. When you launch it, the an open file dialog box appears. If you have any clue as to how to create charts using this tool. Please let me know.

Score: -1/5
Waste your time with Microsoft Visio.


Dia
It's almost as ugly as Visio. The OSX version feels like a hack, with the shortcut keys being all wrong. When you move a class, the arrows don't follow. The lines can be diagnal, but the classes don't lock inline with other classes so it gets pretty messy, pretty quick.

Score: 1/5
It's free, but other than that I have no iDia why I'd use this tool.

Visual Paradigm & Agilian
Agilian popped up when installing Visual Paradigm, it claimed to be the solution for agile software development, so with the buzz on Scrum going on I picked to install that. Looks like Eclipse, feels like Eclipse, when I tried to draw a class diagram, the UML class toolbox was empty, reappeared later though, but you get the idea that it's buggy. Suffers from the same issue of not resizing a class box when you input a long name. Doesn't provide indicator lines when placing a class down for the first time, so you always have to place a class down, rename it, then replace it again. Gets a bit too excited when placing down associations, as in, you place one down, it places it wrongly, you try to drag it to the right place, but instead it decides to turn into a game of Snake. I give up with this, there has to be something better.

Score: 0/5
I can't believe people actually pay to be tortured.

Enterprise Architect

While the website looks like the kind of thing mothers of the future will be teaching their children to stay away from. With their malware inspired use of stock photos of corporation towers and business executives shaking hands. My workmate said that he loved it, and it did the job really well. On launch it asks you which version you want to use, Professional, Enterprise, Business, blah blah, listing no feature differences.. Whatever, I went with Business and Software Engineering. The interface looks a lot like Microsoft Visual Studio 2010, which is a good thing. The class boxes are shaded, which means that it'll impress project managers who are used to looking at shaded PowerPoint boxes. Well, that's enough of the good. The text is too small, creating links between classes is a pain, you drag one between classes then you have to select the connection type from a drop down, very cumbersome. I quizzed my workmate on this and he admitted that he had only used it once.. a long time ago.. to impress his boss.

Score: 1/5
Packed with so much features that you will never use.

OmniGraffle
Macintosh fan boys love this tool. I'm on a MacBook Pro, so why not me? Oh my god, there's a cloud chart. Seriously! Look..
Not really useful for the class connections, but it is pretty fun to use. Ok, what about for a proper class diagram? Well, there's no class diagram option in the menu, but surprisingly enough you can import a xCode project. The parser only works on Objective C classes which is pretty limited and modifying the class contents is challenging. Overall, it's really more of a drawing tool than for classes which is a real shame.

Score: 2/5
Shame it's not built for software architecture diagrams.

Conclusion
I give up. Pen and paper is the way to go for rapid design. For software architecture modelling (after you've got a good sense of the design), I think I'll go back to yEd and give that another spin.

If you have any suggestions for good software design tools, please let me know. I'm desperate..

Monday 11 July 2011

From lib_json to Jansson

I love homogeneity when it comes to developing software. Sure, heterogeneity is required when dealing with undefined cutting edge high performance systems. But for application development, where software elegance and maintainability are key. You really don't want to tie yourself down to platform specific libraries especially in the current "App" world where you want to hit as many platforms as possible. This is why I recently switched to Jansson for my JSON parsing needs.

Jansson is a C JSON library which doesn't depend on other libraries, so if like me you need something to run on Android's NDK which doesn't support STL, you want to be using this.
http://www.digip.org/jansson/

Since I find sample code to be the easiest way of picking up a new library..

Here is example code showing you how to parse your friends list from Facebook's graph api using lib_json.
 #include "json.h"  
   
 ...  
   
 std::string jsonResponse( reply->data.buffer );  
 Json::Value root;  
 Json::Reader reader;  
 const BOOL parsingSuccessful = reader.parse( jsonResponse, root );  
 ASSERT( parsingSuccessful );  
 if( parsingSuccessful )  
 {  
   const Json::Value jsonData = root["data"];  
   const uint length = jsonData.size();  
     
   for( uint i=0; i<length; ++i )  
   {  
     Json::Value text = jsonData[i];  
       
     std::string jsonStringName = text["name"].asString();  
     std::string jsonStringID = text["id"].asString();  
       
     // We can now do something with our Name and ID  
   }  
 }  

Here is example code showing you how to parse your friends list from Facebook's graph api Jansson.
 #include "jansson.h"  
   
 ...  
   
 json_error_t error;  
 json_t *root = json_loads( reply->data.buffer, 0, &error );  
 if( root )  
 {  
   json_t *jsonData = json_object_get( root, "data" );  
   if( json_is_array( jsonData ) )  
   {  
     const uint length = json_array_size( jsonData );  
     for( uint i=0; i<length; ++i ) // Iterates over the sequence elements.  
     {  
       json_t *jsonObject = json_array_get( jsonData, i );  
         
       json_t *jsonID = json_object_get( jsonObject, "id" );  
       const char *jsonStringID = json_string_value( jsonID );  
         
       json_t *jsonName = json_object_get( jsonObject, "name" );  
       const char *jsonStringName = json_string_value( jsonName );  
         
       // We can now do something with our Name and ID  
     }  
   }  
   json_decref( root ); 
 }  

Piece of cake :)

Saturday 2 July 2011

Social Poetry - First Prototype

I spend a lot of my life on Facebook, it's great what they've done with social networking. But, I've always found quirks in the user experience. I've been lately imagining a world where I could easily run through my friends lists, see the status updates and photo galleries in a minority report inspired way. It really irks me that such beautiful beautiful user generated data is only really being exploited by stupid social games like Farmville.. Grr.
I hate Farmville.

So last weekend I set myself the challenge of seeing what I could do with the Facebook APIs, and the following video presents the outcome.



I'm pretty busy this weekend, but I plan on getting at the very least a photo gallery viewer for all my friends.

Currently I'm targeting Qt for the prototype as I'm initially tailoring it as a Desktop Windows/Mac prototype. However as the codebase is based off OpenGL, I have got it running on iPhone and Android.

If you're interested in this project, let me know and I'll be happy to give you an early release.

Friday 1 July 2011

Freedom Square

This 4th of July the Americans won't be the only ones out in the streets with something to celebrate about..


The game that should not have been made will be available for one day and one day only.