March 19, 2007

So, I am sitting in the office on an Indian public holiday staring at 5 dead mosquitoes on my desk. Yes, I killed them after great effort. Bastards. With the amount of these things here on the ground floor, I can easily have a nice pile in a week. It’s OK – they’re just mosquitoes – no one likes mosquitoes, unless they are dead. Bastards.

Anyway, totally unrelated to the mosquitoes… ever have a craving for a particular type of food? Well, forget pregnant women – of course you did! And, I have them all the time too, and most of the time I can satisfy myself. Dominos, Subway, Curd Rice (it’s an Indian thing), mmmmm… But one that pops up now and then … and now especially… is the craving for some Mexican food – some nice bean burritos with melted cheese. At UCI, I would have just taken a 10 min walk down to the Taco Bell or Del Taco right next door (although I used to like Taco Bell while there, now that I think about it, I think I actually liked the Del Taco better). And I used to do it a lot. But damn it! No Mexican place for kilometers in this place. :( Anyone living in Pune know any Mexican places?

Ah… design patterns are wonderful aren’t they?

Singletons, Factories, Commands, Proxies, Visitors, Adapters, etc., etc. Yes, especially in designing and developing software, patterns like the trusty GoF are great. They give you a well-recognized, robust, reliable, reusable, flexible, etc. way to approach problems. Well-recognized because if I name something ObjectFactory, it instantly conveys a lot of structural and behavioral information to the seasoned (even the lightly seasoned) Software Engineer. Robust, reliable, reusable, flexible, etc. because well – these patterns have been put through their paces and are the result of refinement through usage in many systems.

But design patterns are not just useful in software systems. It’s easy to miss the beauty of design patterns in other areas. Consider for example, the network architecture for a large scale web site. At first, it seems like a big secret no one is willing to share. Kind of like an Alliance of Magicians. Not to worry though – there’s a few Gobs out there. So who’s coming to the rescue? Well, we start with … Google! Yes, it takes a while to filter through all the crap to get to some solid secrets-revealing but reading through the good stuff, you will again notice that the design for these sites takes the shape of a few common patterns.

So, here is some of the most interesting stuff available: The LiveJournal Backend Architecture (PDF), the Flickr Architecture, and a great series called the Database War Stories over on Tim O’Reilly’s blog (make sure to click on the links at the bottom to read through all the war stories).

Well, so what are the design patterns for the architecture of a large scale site? First are the front-facing web servers headed by load-balancer. On the other side of these web servers are one or more clusters of databases. Within each of these clusters, simple master-slave replication may be setup, or there may be horizontal or vertical data partitioning setup (which may also be across clusters, depending on the exact setup). There may also be a cluster for serving static content (such as files, HTML, etc.). Cache server (ex. memcached) clusters are also possible. The point is: there are clear patterns, and even solutions to easily implement these patterns. I leave it to you to get the details – they are all good reads (if you’re into that kind of thing).

So, ever since the “incident“, I always used to get a shudder everytime I happen to connect the laptop into a power outlet that didn’t work. Everytime I connected the thing and the little charging indicator didn’t come on, I would start freaking out. Oh my god! Not again! You get the idea. But then I plug it into a nearby outlet, and it starts working again. Phew! What a relief!

Well, now, the damn thing actually stopped working. ARRGGGHHH!! It happened early morning on … well, that doesn’t really matter. What matters is that IT STOPPED WORKING … AGAIN!!! Now the people at Toshiba won’t replace it because its out of warranty by a couple of months. I’m thinking faulty power adapters but I still have to go buy me another one of those. Maybe in 3-4 months, I will have to buy another one after that.

 Wonderful. Thanks Toshiba. You Guys Suck.

How we tend to be jerks…

February 27, 2007

I was reading this post on 7 Reasons Why YOU Are the Next Great Game Developer and it struck a cord.

For one thing, I went through that phase (yes, its a phase for Software Developers) where I wanted to create the next great MMORPG. And I knew for sure those jerks that kept telling me it wasn’t going to happen were all morons and should just shut up. There were lots of them too. But I ignored them, and marched on… aimlessly… for a few months (or years maybe?). In the end, the morons were right. But you know what? I learned a lot about open source, about programming, computer graphics, and a lot of other stuff from that experience. I also got to meet and make online buddies (from all over the world) with some really interesting people – and I still keep in touch with a few of them. Looking back, I would have definitely done things differently but I think as an experience, it was a useful and enjoyable one. … Eventually, I did make a few semi-complete games – one with some guys during my freshman year at UCI, and another during a Univ. course (this course/subsequent event was featured here actually). I also joined up with the Video Game Dev. Club at UCI, where we actually did make a few (OK, at least one) semi-complete game and even got to help out Dave Perry when he was working on a game design book (he even gave us some really neat gifts!). The thing is … if I had not cultivated the love for game design and development with the failed MMORPG, I wouldn’t have done any of the other stuff either – and I definitely would have regretted that.

Lesson? I guess it is kind of something like – even if an idea is stupid, and everyone is telling you so, you will eventually get something out of it. And the idea probably isn’t stupid anyway – people just tend to be jerks – they like to criticize first. I admit – even I have done it … in fact, a lot. I share ideas (software & business ideas) with my brother lots of times and he does the same with me. He shoots down most of mine, and I shoot down most of his (actually, I don’t think he has had any good ideas yet :-P – just kidding bro). I think I do go with some slight hope that he finds a particular idea cool too. But most of the time there’s problems. I now prefer that he mostly point out whats wrong and why something won’t work rather than why it might. And its not just with my brother – someone else brings up something useful, I try to criticize first. I don’t know where I picked up that bad habit (is it?) but I do do it (Word would have highlighted the second do by now). Actually – it might have been the ##c++ channel on freenode – what a joyfully geek elitist channel that is. When you first go to the channel, you start out wondering why your simple polymorphism question turned into everyone ganging up on you to tell you how your program is fatally flawed (and they haven’t seen a single line of code in it!). Over the years, you eventually pick up enough of C++ to start being one the jerks on the other side who gets ready to pounce (with your gang of nerds) on that unsuspecting species – the n00bs. Yep… that was it – hanging out in that channel is what turned me into this arrogant criticize-first (I swear its like an instinct) guy.

Wait, I’m not going the direction I want to go … what I actually want to say is that critics are helpful most of the time. The reality is that most video games are not very successful – most companies are not very successful – most people don’t get filthy rich – most people don’t become famous – most MMORPGs fail. These are things you probably considered but in the end, you somehow dismissed them. I do that – I somehow dismiss important things – I later forget why exactly I thought my social networking idea was better than myspace, and why my groupware application was going to rule them all! Then my jerk of a brother or one of the friends comes along and says HEY STUPID! – you did realize you can’t dismiss that right? A lot of the time that little voice has been trying to yell in your ear but you haven’t been listening. But sometimes, there was no little voice and what the critics say is something you never considered at all.

So, even though this article was a nice pick-me-up and feel-good piece (OK, it was kind of helpful too), the let-downers and kill-joys also have solid advice to give. They just have to make it more friendly. CONSTRUCTIVE CRITICISM people!

Recently, I stumbled upon a few nifty tools that let you find out more about OS projects.

 First is Ohloh, which I came across as I was looking at the OGRE site. It collects some nice and useful stats about any project with a CM repository. It counts LOC, including percentages of code that are in various languages, it builds some nice history views – history of developer commits, and an overview graph of code history. It also has an interesting project effort and cost calculator. Based on these stats, it makes a few assertions like “mature codebase”, “active development” etc. It also collects rss feeds related to a project, and lets users add their own reviews, etc. Things I would really like to see is a way to browse projects instead of just search for them. When they have collected such detailed stats, it offers the possibility to browse OS projects in cool ways that they have not yet offered.

 Second up is Krugle - it is yet another code search engine. But this one offers a nice ajaxy interface including tabs (with search results and invidual code views given in different tabs). It also has a treeview which shows each of the code files being viewed in the context of the other files from the same project – an excellent feature.

So, I’m now in India – in Pune, Maharashtra. Its a decent place – er, well, its not a terrible place – my home is kind of out in the middle of nowhere – in a small little village called Kharadi.

The office is also in this little village – I work at Zensar Technologies, Ltd. – yet another of those Indian services companies. But hey, don’t worry, if you are in the US, I probably did not take your job – I work as part of an internal innovations team – not for some external client. So, it wasn’t me. But, it might have been one of the other people I see walking around campus everyday. And thats all I’ll say about that.

Meanwhile… while I am definitely not a prolific blogger, I think I will now have at least something to write about considering I have a job. However, it comes with a new curve ball which might hit me smack in the face (is that expression ever used?)  if I’m not careful. I did sign some sort of paper (it was actually a little book I think) that says something about protecting the IP of the company – so I should tread lightly lest I fall straight to “down there”.

Anyhow, maybe there will be a bit more of technical nonsense in the next post.

I was looking for some tools to test .NET 2.0 code as thoroughly as possible. NUnit is definitely a great unit testing tool – setting up test cases is extremely easy and in addition, it comes with a great GUI based test runner (which can be invoked from code as well). However, I really wanted to get code coverage information as well. I looked at CoverageEye.NET but I don’t think (at least I couldn’t get it to) it works with 2.0 assemblies yet. NCover seemed good but just by itself, it has a command line interface. Looking further, I found that SharpDevelop 2.0 has both NUnit and NCover integration. I had tried SharpDevelop when it worked with .NET 1.1 (at that I felt it was a bit slow) but hadn’t tried it since. However, I thought it was a great time as any to give the new version a try. I have to say – this is the solution to my problem! Its NUnit/NCover integration is great. I was able to do unit testing/code coverage as I expect to do it – write your tests… use a GUI to run those tests, and automatically see visually (within the text editor, with green highlighted portions being the covered code, and red highlighted portions being uncovered code) what code is covered. Also, I have to say I am impressed with the other parts of #develop 2 as well… its features are getting to be on par with VS 2005 – it even works directly with VS solutions and projects. There are still a few features I need for this particular project (for ex. displaying the actual names of Enum values instead of integer representations in the debugger) that keep me from using it directly. However, at least for unit testing/code coverage, this is great! Small note: I think you may need to install NUnit and NCover before the pieces inside #develop start using them.


Get every new post delivered to your Inbox.