Saturday, October 30, 2010

Async Web Application and Concept Based Architecture?

I've been brainstorming about maximum efficiency, performance, and scalability in regards to web application frameworks; none of them really seem up to the task. After reading a stackoverflow.com post about ZeroMQ (www.zeromq.org), it got me thinking about distribution of specific tasks or concepts to "mini-apps" and how that could be done.
The following mindmap shows how I've broken up a typical web application into its component concepts.


By using a technology like ZeroMQ, each concept could exchange data loosely with another. For example, the Web Application could send a message requesting an SEO header and the Tracking Concept could do something with that message and trigger a Google Analytics event, the Monitoring Concept could intercept the Google Analytics event and log it, then the Reporting Concept could ask the Monitoring Concept about its latest log and process a report. All this could happen asynchronously and in the background where even the Web Application doesn't know everything that's going on.

This idea is completely language and location agnostic. ZeroMQ can connect nearly any language "mini-app" to any other language. Let's say you have a legacy Java application and your current team of developers knows python or ruby better. Your developers could wrap the functions you want accessed in the Java application with ZeroMQ and connect using python or ruby. Also, lets say you want to leverage the processing power of many distributed computers across the United States, located in multiple colo facilities. You could run mini-apps in all the locations and as long as they have a network connection, they can talk to each other.

Imaging using a message queue to build an interface between a C#.NET 4.0 application maintained by an outside vendor using Lua or python without worrying about dlls or COM wrappers.

I am going to explore this idea a little further this weekend. Maybe there'll be a new GitHub project started using this idea... maybe...

Saturday, October 23, 2010

Clean Code: A Handbook of Agile Software Craftsmanship

Bravo to the authors of Clean Code! You have written an amazing and stimulating book; at least for this coder. I've passed it on to a colleague who, after only a day, is in love with not just Clean Code, but reading itself.

To anyone who actually reads this blog, if you're a coder get this book. It will make you question how you code and make you more critical of your own code; this is a good thing. It has brought new creativity and stability to my code.

Friday, October 15, 2010

Git-SVN Bliss

So my dev team likes and knows Subversion. I like and know Git. Can they exist together? Sure!

Using git-svn, I can use git locally while they use the bloated bastard that SVN is. I can make smaller commits, push and pull between my home and work machines, and send all my commits at once to the SVN repo on our server. All while using the merging awesomeness that git has.

How easy is it to use git-svn? Extremely simple.

git svn clone http://your-svn-repo-url reponame

That sets up the repo. How to do 'svn up' and merge? git svn rebase. How to push your commits to SVN? git svn dcommit. How to change branches/tags? git reset --hard remotes/branchname. Before you reset --hard, either commit and push or stash your changes, they will get overwritten as normal.

So I get the bliss that is git, my team gets to use what they're familiar with; win-win!

Sunday, October 10, 2010

Django and Templating, is it Zen?

So Django uses a template language I don't like and I don't feel like modifying Django to make it use one I like. What do I do?

First of all, why am I using Django? Because it organizes and handles my data the way I want it to. Because it is extensible and I can turn off features I don't need to use.

So what do I do?

Why not have Django output standard XML instead of HTML? I can use XML with just about anything. I can test it, validate it, parse it, hell I can do anything with XML. So here's my solution, have Django output XML using my custom namespaces and write WSGI middleware to transform the XML into HTML.

The templating language I want to use is Genshi. Its templates can be validated and tested independently of the data, big pluses for me and my team. I can write wrappers for its API and Django's internals so there is good separation there. If we decided to move to CherryPy instead of Django, all we would need to do is connect our wrapper to the API; all our custom code would be unchanged.

So here I am, on the ragged edge, Django in one hand, Genshi in the other, tying them together without tying them together... How Zen of me...

Saturday, July 17, 2010

First of Life's Most Important Questions Answered

I have found the answer to one of life's greatest questions, does God exist? I believe he does.

I've always had a problem with organized religion because I believe man is fallible. If man tries to interpret God's message to the masses, he will invariably get it wrong. No meat on fridays, being kosher, praying 5 times a day at a specific time, do you really think God would require such things? I say no. Also, how can an elected man be "closest to God?" Of course I mean the Roman Catholic pope. If man is fallible and you increase the influence of man on a godly position, wouldn't that corrupt the position? Of course it would.

Then you have "social justice" preachers telling us our salvation is bound to the person next to us, that we are our brothers' keepers, and it is up to us to make sure everyone gets saved or else no one will. This really turned me off to religion and I began to believe if there was a God, he wouldn't allow this to happen, therefore there was no God.

A decade after I started to believe there was no God, my own actions reflected my belief. I had become someone I would now distance myself from. Then a few miracles happened in my life.

A close friend of mine gave me some perspective on one of my own failings by allowing me to witness how the actions of someone else affected her. Even then I was no where near the man I am today but I credit her with giving me a little sight into who I could become and who I wanted to be.

After working in a low paying, yet fun job for a while I had another glimpse into what kind of person I shouldn't be. A coworker that had become a friend of mine got arrested for domestic abuse. His actions were very regrettable and I'm not sure how things turned out, but that situation gave me some further perspective.

A few years later I started to study string theory as a hobby; so I'm a little strange, it was an interesting theory. Everything in the universe could be explained by vibrations of higher dimensions. As you know, sound is a vibration. I started to think about it and a fantastic and beautiful image popped in to my mind.

If the universe were a theater and you used string theory to explain how the theater came to be, the singer is the one creating the theater. Then I thought, if the one singing is God, with his song, he is creating the walls, floor, ceiling, seats, spectators, lights, everything. And every change in pitch, every emotional overture shapes and changes not only the walls and floor and ceiling, but also those who are listening and even those who aren't. This means God has a role in our lives and our lives have a role in him.

So this mental exercise may be a little unorthodox, it may be a little crazy, but it got me the answer I was looking to find. God does exist and he does play a role in everyday life. Not only that, but what we do has an impact on God as well.