Tuesday, April 26, 2011

Evolutionary Database Design

Howdy! Techy post, for a change. I recently read this great article from Martin Fowler which explains quite clearly and simply the benefits and patterns that come with embracing change in software development from start. The article speaks specifically about how to prepare both practically and mentally to change your database a lot, and often. It is funny how most of us reject the idea of changing design or database decisions in the middle of projects. Assuming they will change and preparing for it can be a quite stress releasing experience (especially knowing how requirements or their interpretations almost ALWAYS change, and very fast).

Here are some key ideas which I personally saw enlightening:

  • The design of the system has to evolve through the various iterations of the software. 
  • Look at design as an on-going process that is interleaved with construction, testing, and even delivery.
  • Agile processes run complete life cycles in each iteration, completing the iteration with working, tested, integrated code for a small subset of the requirements of the final product.
  • Most people consider that database design is something that absolutely needs up-front planning.
  • Changing a schema after deployment results in painful data migration problems.
  • The developer knows what new functionality is needed, and the DBA has a global view of the data in the application.
  • Everybody gets their own database instance: people learn by trying things out. It's important for each developer to have their own sandbox where they can experiment, and not have their changes affect anyone else.
  • As a rule of thumb each developer should integrate once a day.
  • The pain of integration increases exponentially with the size of the integration.
  • A database consists of schema and test data. By having sample data, we are forced to ensure that any schema changes also handle sample data. You should try to introduce real data from the very first iteration of your project.
  • Every database refactoring is automated by writing it in the form of SQL (these changes are never applied manually).  We keep hold of these script files to produce a complete change log of all the alterations done to the database.
  • Once we do a release,  we apply the full change log of database refactorings since the previous release. 
  • As well as automating the forward changes, you can consider automating reverse changes for each refactoring. If you do this you'll be able to back out changes to a database in the same automated way. 
  • Have a clear database access layer to show where the database is being used and how.
  • Creating a new database lineage is much the same as branching the source code on the application.
  • Whenever you run into repetitive tasks in software development you are ideally placed to automate them.



You can refer to the original article for more info, if you are a software developer I really recommend you to read it! You can tell me in the comments what you think about it.
Cheers!
Manuel

Sunday, November 21, 2010

more on puzzle game

Hey! It's been a while since my last update, since I've been quite busy with some university assignments and work. Some news on the computer connectivity puzzle game!

I've completed the code for virus expansion through the network. When you click the '*' button, you are no longer allowed to rotate pieces, and the virus starts to creep through the cables. (as usual, graphics suck, but I'll take care of that in the future...)


Note how the connected PCs get infected, and how virus only reaches the sections of the network which are connected to the originally infected host.


I've also added score calculation based on the proportion of the network which ends infected and the amount of computers taken. And after you press the button and watch the virus take the network, a new level is loaded (I should probably add an intermediate screen showing score for that level and some extra info). I'm thinking of a possible game mechanic which is basically that the player must solve as many levels as possible in a fixed amount of time (say, 2 minutes). There will also be a "Relaxed Mode" where you can play without the time ticking behind, but I think it would be fun to have something like a global leader-board for the fastest solvers! :)

Oh! Another important development: I've decided the game will include music from DoKashiteru. They have generously released some great tunes under Creative Commons License, so go check them out and tell me if you like any in particular. Some of their best, which I'm planning to include in the game:
and the real MASTERPIECE:

Yiourgh




Please let me know what you think!! Thanks for reading

Tuesday, October 26, 2010

New puzzle game

OK, some days ago I started a logic puzzle game, and today I decided to push it forward. It still doesn't have a name, so be welcome to recommend one. 

The (not-so-original) idea is to connect a set of computers in a network by rotating switches. The first thing I needed was a way of generating a random network of computers. I used something very like good old Kruskal for the connections, and got pretty nice results from the start :).


Adding computers to this useless network is a matter of just selecting some random nodes, and voilà:



Graphics are just for the prototype, I'll get proper ones before releasing the game, of course. The next and last step in generating the initial board is to randomly spin each tile so that the player has to figure out the original configuration by rearranging them. Here's the result: (I also increased board size in this one)



OK, so next was the tedious work of mapping the user's touch into a single tile, but after some hours of maths and testing I nailed it, alright. I also figured that no one would be able to select each individual tile with his huge finger (in relation to the tile's size, hehe), so I decided to increase the tiles and to test it on a real device. I also added a special computer, which I call "mother server", hehe. I think the idea of the game will be to rearrange connections so that the green virus infects all the computers of the network, or something like that... 



Anyway, that's all. I hope to finish this game before November, although I'm not very optimistic about it.  Oh, if you think of a name for this game, please tell me because I'm quite clueless on that...