quarta-feira, 3 de novembro de 2010

World Usability Day 2010

For thoses that will be in São Paulo at 11th of November a good call is to participate of the World Usability Day that will happen at UMC (Universidade Mogi das Cruzes).

But if you are not in SP but wants to participate don't despair! The World Usability Day is organized around the globe, here you can find a full map with all the places and dates.

See you there !

Today I go with Out of the silent planet, from the Iron Maiden's Brave New World album.

terça-feira, 12 de outubro de 2010

Time! What is time?

Soon or later when you are working in a software project you will face a little element that can cause quite a big mess: time.
When I say time, I am not talking about the time to finish the project, time to perform a specific task or the software performance; in this case time is the time element of the data that you are working with. Doesn't matter if it comes as an hour and minute representation, a timestamp or millisecond counter; soon or later it will be there, and even if looks simple evolve into a irritating problem.

The usual solution to the statement "We need a timestamp!!!" is to get the millisecond of the computer clock and store it into the database, but in almost all the cases it is not enough. To know if it is enough or not, first we need to understand why do we need the timestamp; is this timestamp used only for user information, something like what date/hour something happened, or does it have a meaning for the system?

If it is only for user information, maybe a timestamp is not needed, you can have date (which includes the time) fields and make you user happy. But when it starts to mean something for the system things get a little bit more complicated; but if you need it for both purpose I would say to start splitting it: the user information should go in a field (even if it is created by the system) and a field with the timestamp; in this way you can have a field with comprehensive information for the user AND a field that can be managed by the system without magic.

So the next question is: why do the system needs a timestamp? To explain that I will start explaining what are the properties of the time, and based on those properties it is easy to identify where it could be used.

"But what, in fact, is time? If one concentrates on the structural aspects, then the prevalent view of time is that of a set of “instants” with a temporal precedence order satisfying certain obvious conditions such as transitivity, irreflexivity, linearity, and density. Interestingly, however, in most cases when we make use of time and clocks we do not need all these properties – for example, digital clocks obviously do not realize the density axiom but are nevertheless useful in many cases."[1]

So basically a time is something that can give to you the temporal idea, did A happen before B? Did something happen between A and B? So when you want to enable you system to work with such kind of question a time element is required. The next question is: how do I do it?

The first reaction is to use the machine timestamp, but doing things like this is a little bit danger because: to events for the same process can happen at the same time (remember that you are working at milliseconds level and you easily can have more than one event happening at the same milliseconds). Or you could have more than one machine, even in the server environment, today with clusters and high processing scale it is really likely to happen. Imagine that you have two events happening for the same process in different machines, they could end with the same timestamp, although they must follow the linearity rule.

I will skip the notation for the time related events (all those: before, after, depends, not depends), the important rule is: if the events are time related they should have a sequence, so I should be able to define which one happened first and which happened after. For that we need a consistent timestamp, and in most of the cases the easiest implementation for it is a Logical Time. What means that you have a time that has the transitivity, irreflexivity, linearity and density needed for a time, but at the same time it doesn't depend of a real clock.

There is different ways to implement a logical clock, one of the simplest is a Scalar Clock: in a nutshell a scalar clock creates a timestamp every time that it is asked, and for each creating the timestamp generated will be greater than the previous one, and it never creates something backward, always forward (in real life can you go back in time and do things that you would like to? or undo something? no, so in software land it should is also not be possible).

You can see it as a counter, which always increase. Looks simple and stupid, but such kind of clock should guarantee that doesn't matter what happens it will not create something into the past; but it is not among those guarantees the need to have sequential timestamps, in fact it could jump sequences.

Simple? Well not that much, imagine that if you have multiple machines in your cluster such clock should provide valid timestamps for all those machines, at the end it shouldn't matter where the timestamp was created, they should attempt to the constrains.

A bottle neck? Yes it could be, but according to the Peng and Dabek the Percolator scalar clock "serves around 2 million timestamps per second from a single machine"[2], so once well implemented the scalar clock could be a feasible solution.

You should notice that a scalar clock doesn't differentiate between processes, so even not related events will have a time relation. When it is not need or desired you can start looking for different type of clocks like a Vector clock or a Matrix Clock[1][3].

At the end remember, it is important to have consistent timestamps, and most of the times the system timestamp is not enough to conform to the required constrains (transitivity, irreflexivity, linearity and density). So if you need a timestamp, before doing a getTimestamp look around and check what other options you have.

[1] Mattern, F. – Logical Time. Darmstadt University of Technology.
[2] Peng, D., Dabek, F. Large-scale Incremental Processing Using Distributed Transactions and Notifications, pp. 06.
[3] AGUILERA, M. K., MERCHANT, A., SHAH, M., VEITCH, A., AND KARAMANOLIS, C. Sinfonia: a new paradigm for building scalable distributed systems. In SOSP ’07 (2007), ACM, pp. 159–174.

The natural song choose for this post is Time What is time, from Blind Guardian.

quarta-feira, 6 de outubro de 2010

Honey! It's not what it looks like: CODE REVIEW

Today I will start a new brand of posts: "Honey! It's not what it looks like". The idea here is to present some concepts about terms commonly used, but sometime misunderstood or just not clear enough to give a common ground for a good conversation.

Some confusion could raise when we use those kind of terms, you may use them expecting something and you get a completely different stuff; it is like in the every day life, you expect something in the other hand you get a raining of popcorn in your head, a dog barking or running at you and so on. The best we can do is go get a common ground about the terms, so every time that you see "Honey! It's not what it looks like" it will be me trying to discuss some of those terms.

As starter I will stick with code review. When someone comes to you and say: we need to do code review, what does it means? What are the expected outcomes from the code review? In a conceptual world which software engineering discipline is it included?
Let's just set the ground, every word or better group of word could have a locale meaning, I am not saying that those meanings are wrong, absolutely not, just saying that when those meanings are not clear, maybe you will get what you expect, but probably you will end up with popcorn in your head.

Looking at the Pressman[1] definition for FTR: "A formal technical review is a software quality assurance activity performed by software engineers (and others). The objectives of the FTR are (1) to uncover errors in function, logic, or implementation for any representation of the software; (2) to verify that the software under review meets its requirements; (3) to ensure that the software has been represented according to predefined standards; (4) to achieve software that is developed in a uniform manner; and (5) to make projects more manageable.", let's focus at item 1: the objective is to uncover errors in function, logic or implementation of any representation of the software, and the code is a representation of the software, as much a class diagram would be or a architectural design.
So from the Pressman definition we can say that a code review is a FTR applied at the code, which is a representation of the software, so from now on we can exchange the terms code review and FTR.
With the bases set: code review is a FTR, we can look at the other objectives of a code review; verify that the software meets the requirements, guarantee software standards, achieve development uniform and make it more manageable. Well that is perfect, right? With a simple review I can achieve all of it?

The answer is: yes and no, that is why: in order to achieve the desired output we need to have a proper input, for example the item 2. Do my software meets its requirements, yes a review could give you this answer, but to get the answer you need to have a proper requirement, otherwise how can I review my code? So when you ask for a code review and expect to have a item 2 attempted you need to give the proper input, and if you don't have a proper input, well then you have a problem.

I will not extend the discussing about the other items, but all of them require proper input to give you a proper output. I am not saying that the proper input is the 100% guarantee of a perfect output, but it is a good trail. In the other hand, it is not mandatory that all the output could be expected. You could say that I just want item 3 or item 4 or even another thing, but that need to be said.

The other element that you need to consider when you say –"I am going to do code review", it is how you are going to do that. According to Pressman[1] a FTR " is actually a class of reviews that includes walkthroughs, inspections, round-robin reviews and other small group technical assessments of software. Each FTR is conducted as a meeting and will be successful only if it is properly planned, controlled, and attended", are you planning to do all of it? If you are not then you need to understand that not all the outcomes from a FTR will be there for you or it will be valid.

Let's suppose that you don't have a meeting for the code review, how will you be able to achieve a development uniform knowledge in your team? A FTR when done by different people is a powerful tool to spread knowledge, sure we have alternatives like pair programming, but the alternatives should be investigated, and it is absolutely true that you need to do something, it doesn't come for free (again you don't do it properly the dog will bark at you).

There is alternatives to a FTR, to be more specific a FTR at the code exists, like the previous referenced pair programming, and there are others (you will find some references to other articles and web pages at the end of the post).
The important issue to consider is: what do I want to achieve with code review? Meet the requirement, standard code, spread of knowledge, manage my projects, etc; and from this point you need to start filling what those words mean. And remember, the experience proved that a code review done by more than one people with different knowledge about the problem is much more effective than a single person reviewer (ok I know that I should put some proper article reference here, so if you want I can bring it).

And before the end I would like to point to another detail concerning the FTR; where the FTR is placed in the Software Engineering disciplines. It is an instrument of Quality Assurance.
Some could say that in XP the pair programming is done by the developers and it is a code review; that is true, but it is still a Quality Assurance instrument. But why is it important? It is important because it shows what kind of purpose this tool has, it is not a testing tool, and it is one of the instruments to guarantee the quality of the code into the process, you should remember that one of the purposes of the Quality Assurance is to guarantee the quality of the product through a better process.
In this case the better process is achieved, for example, with the code knowledge spread across the developers. At the end while you are doing FTR you are also improving your software process, but it should be done properly and if this idea in mind.

As promised here it is a small list of articles about people discussing FTR, mainly code review, plus a website with a check list for code review[5] (could be a start for this kind of checklist):

[1] R.S. Pressman, Software Engineering – A practitioners's approach, MCGraw-Hill, 2001.
[2] T. Stalhane, C. Kutay, H. Al-Kilidar, R. Jeffery, Teaching the Process of Code Review, Proceedings of the 2004 Australian Software Engineering Conference (ASWEC’04), 2004.
[3] A. Vardhan, Learning to verify system, 2006.
[4] A. Harel, Prof. E. Kantorowitz, Estimating the Number of Faults Remaining in Software Code Documents Inspected with Iterative Code Reviews, IEEE International Conference on Software - Science, Technology & Engineering (SwSTE'05), 2005.
[5] Macadamian, Code Review Checklist, http://www.macadamian.com/insight/best_practices_detail/code_review_checklist/, 2010.

So remember that from time to time we need to recycle your dictionary, your common sense. Said that I will let you with the song, Time after Time, from the Brazilian band Dr. Sin.

segunda-feira, 4 de outubro de 2010

Is my browser compatible?

Well this kind of question is quite common (unless you don't care at all about the subject). There is a lot of methods to check if the browser is compatible or not and for sure none of them replace the testing approach (test in all the browsers that you want to support).

The Browserscope project could help a little bit in this manner: it has a set of testing to check the compatibility of the browsers against the standards and they have the reports for the common browsers, so you can have an idea if the resource is supported or not. They divide the tests in 6 groups: Security, Rich Text, Selectors API, Network, Acid3 and JSKB; and you can even run the tests online in your current browser.

Absolutely it doesn't answer the question: "Is it going to work in all the supported browsers?", but it could give you a hint about things that for sure are not going to work.

We all know that the browser compatibility is a problem without a near solution so we must carry on with it (and keep testing), let's do it listening Carry On, from the Brazilian band Angra.

segunda-feira, 13 de setembro de 2010

And the week begins...

Today is Monday, so instead of talking about any issue, I would prefer to come back the series of "Nooooo it cannot be true, I haven't read it!".

Software Illusion

Code talks


Well, what can I say?


Enjoy the week ;-)

The music is not related to the post, but I was listening to it yesterday so here it goes Long Before Rock 'N' Roll, from Mando Diao.

quinta-feira, 9 de setembro de 2010

Gaming contest

The Mozilla Labs start a call for a game creation competition, the idea is to create games for Open Web and the browser.

Check it out at the Pascal Finette blog.

See you there ;-)

I Read the blog enjoying the song Kiss With A Fist, from Florence and The Machine.

sexta-feira, 30 de julho de 2010

Another new language for the JVM

Some say that it is java, others say that it is Ruby, but in fact it is a brand new experimental language: Mirah.

Mirah (nee Duby) is a new experimental language born out of the JRuby project. In order to make implementing Ruby on the JVM easier and more approachable for Java and Ruby developers alike.
Here you can find the project page. And for those that want to understand why another language, here you can find an interview with one of the Mirah's creator Charles Nutter.

quarta-feira, 14 de julho de 2010

For those about Android!

Check here how to have an Android OS running inside of a Virtual Box.

Enjoy it!

terça-feira, 29 de junho de 2010

CSS Blue prints

Today let's talk about something lighter than code, numbers, database. Let's talk about CSS and page layout.

The page layout normally is a pain even to web designers with a lot of experience, imagine for the poor developers worried about their code. But there is some CSS frameworks around the web that could be used to reduce quite a lot the effort to create a prototype or even the final page layout.

As you need to have a good foundation at Java to use any Web framework around, you should have a good foundation at CSS and page layout to use those kinds of framework. The good point is that even if it is not your case you can still use those frameworks as a start point to learn about it.

One of those CSS frameworks is the Blueprintcss:

Blueprint is a CSS framework, which aims to cut down on your development time. It gives you a solid foundation to build your project on top of, with an easy-to-use grid, sensible typography, useful plugins, and even a stylesheet for printing.


First we need to understand what is a CSS framework. Let me say that it is not: it is not a magic box that everything renders magically, it is not a code generator for CSS, it is not a component that you plug into you HTML page and the page is rendered automatically. A CSS framework is just a pattern that you should follow to develop your web page, elements and CSS styles, and provide the foundation for a fine and consistent layout.

The first step of those CSS frameworks is to define how the elements will be displayed into the page. Blueprint, as many other CSS frameworks, divides the page in fix size columns which are used to place the component elements. For an example: imagine that you divide your page in 24 columns of 10 pixels each. You can say like, my header will be a box that will take over 24 columns, my left menu is a box that takes over 10 columns and at the side of it my body will take over 14 columns. So basically with this kind of layout style you just need to create boxes and say how much columns does it takes.

As this column division is not produced using tables but using divs and styles to make it as big and the amount of columns that you expect, you will end up with a tableless layout too.

The second characteristic of the Blueprint is to define the fonts, there is a basic set of fonts to guarantee that you page looks like the same in all the browsers. Not that it is not just the font familt, but also the size, space and etc.
And finally it provides you with a set of other styles that can be applied to your forms, tables and so on.

There is much more there so far I recommend you to take a look at this example (you will understand much better how the column layouts work): A Closer Look At the Blueprint CSS Framework.

Using those kinds of frameworks (Blueprint is not the only one) is a good step to simplify the page layout, but it for sure do not replace a good layout and user interface analysis. Take a look, you may not use the framework, but I am quite sure that you can take some ideas over there.

For those that wants to go further the project wiki page as really good material: http://wiki.github.com/joshuaclayton/blueprint-css/.

And as usual the sidekick, today I recomend the song Ya no sé qué hacer conmigo, from the Uruguayan band Cuarteto de Nos.

quarta-feira, 23 de junho de 2010

Let's calculate

Everyone knows that float point numbers are far from been precise. In fact they are as precise as any other number, the problem is that they work in a different base (2 instead of 10).

Let's take an example to illustrate that: the number 0.01, it is a quite simple and clear number in base 10 notation. Now let's add to it 0.09, which is the expected result? 0.1 right? Well doing it using floating point numbers we will get: 0.09999999999999999.

But why? We it is because altough 0.01 and 0.09 can be easily represented in a base 10 notation it doesn't have a real representation in the base 2 notation. It is something like 1/3 it is 0.3333334, the same with those number. What we have at the end is a periodic number, which is rounded to provided the expected number, but when we do a calculation this number cannot be rounded anymore.

Basic stuff, and I guess everyone faced it before, expecting the right result is the same of someone (yes it is a true story) that wants to divide the 100% by 3 and sum it back and expect to have 100%. Well it is not going to happen, 100% by 3 is 33,333333% and it sum back is 99,99999999%.

Sure that there is nice ways to work around this problem, in most of the languages. But all this introduction is to say about this ways, it is just to present a really nice calculation component/program that you can use in your Java programs: Frink.

"Frink is a practical calculating tool and programming language designed to make physical calculations simple, to help ensure that answers come out right, and to make a tool that's really useful in the real world. It tracks units of measure (feet, meters, kilograms, watts, etc.) through all calculations, allowing you to mix units of measure transparently, and helps you easily verify that your answers make sense. It also contains a large data file of physical quantities, freeing you from having to look them up, and freeing you to make effortless calculations without getting bogged down in the mechanics."
You can use it to calculation with the right precision your nice mathematical stuffs (no more error in 0.01 + 0.09), but you can do even more with that. You can virtually convert any unit to any unit.
The possible calculations goes from the normal phisical stuffs like, energy to temperature to crazy examples like how much time Superman should recharge his energies at the Sun to save Lois Lane and some kids, or even further how much weight Lois should loose to help Superman saving some kids (check the examples here).

Take a look at the main website, it worths and can be really helpfull for you, when you need to do some nice calculation in your application.

And finally for those that want to go further in floating point theory: What Every Computer Scientist Should Know About Floating-Point Arithmetic.


A good sidekick for this post is The Magic Numbers - Forever Lost.

Enjoy it ;-)

quarta-feira, 9 de junho de 2010

Apache Pivot and news

It has been a while since the last post. Unfortunetely the time is still short to continues with the DOD posts, in this meanwhile I will talk with a relatively new Apache project: Pivot.

As stated in the project main page the purpose of Pivot is to:
Building rich internet applications (RIA) in Java by combining the enhanced productivity and usability features of a modern RIA toolkit with the robustness of the Java platform.
The first issue that should be clarified, it is not a HTML+CSS+Javascript solution like ExtJs or JQueryUI or any other framework around. It is in fact a framework for build application in the old and good JVM.
It means that to run this RIA application you still need the Applet (or webstart), a JVM in client and all the stuff for this kind of application.

The first question is: so not why Swing? First of all the Pivot UI classes provide a lighter implementation than Swing, something like Thinlet. All the UI elements are rendered using Java2D and it also provide some nice effects (over the tradicional Swing).

On the top of it the interface can be created with a declarative language, so you don't need to use that huge amount of code. They have choosen to use the WTKX, which is a XML that you can specify the interface (acording to the project website: "A nice and open XML for declaring graphical user interfaces in Java"). This fact is already a great advantage over Swing.

And finally why RIA? Is it not just another UI framework. Well in fact no, it also comes with a set of classes and libraries that makes the comunication with a webserver much easier, thinks like http calls, web service integration and so on.

I think it as a good alternative for traditional Swing app, maybe not just for RIA application, even for your Java desktop app. Such kind of integration with the webservices is really usefull.

What I still miss there is a better way to deploy your application over the web. Using applets and webstart is still a pain.

By the way, before saying see you next time, I would like to introduce a new session in the posts, a part that can be used even if the post is really boring or not usefull at all. For example, tip for a song, movie, a cake receipt, a joke, whatever. Today I will go for a music, so...

A good sidekick for this post is Dropkick Murphys - Johnny, I Hardly Knew Ya.

segunda-feira, 31 de maio de 2010

Agile development and how people are using it.

Are you interested in Agile Development? There a quite interesting Scott Ambler webcast that you could be worth listening to it.
This webcast is a IBM presentation, so you could expect some IBM view and products for Agile, but at the same time it is based in a survey distributed across many organizations, so you also could expect some real information (like what happens when the teams are distributed and not collocated as the initial ideas, agile only works for small teams and so on).

Any way as Scott say in the webcast, there isn't any new in Agile Development compared with other kind of developments. So don't expect magic words to make everything start working from day to night, but I recommend you to spend some time listening to it and put some extra color in the big picture of Agile Development.

Here is the link to the webcast: Busting the Myths of Agile Development: What People Are Really Doing.

Have a nice week!

quinta-feira, 20 de maio de 2010

segunda-feira, 17 de maio de 2010

Thoughts about Document Oriented Databases - part 3

In the last post I presented the first Use Story and the base classes for the problem, now I will walk into the service layer.

Let's make our example a little bit more complete with others user stories:
NEWTON: As a nerd, I want to be cool having the possibility to have a specific night for a specific day.
I can have a night for a specific day that differs from the normal night for that day of the week. It is a special night occasion.
PASCAL: As a friend of a nerd, I want to know when a night happens.
Based on the name of the night I want to know when it happens.
Based on the day of the week I want to know what is the night of that day <(I don't want to avoid those nerd guys)>.
I want to know which night of a specific day.

We have based your class diagram on the PYTHAGORAS use story, now with the addition of the NEWTON and PASCAL user stories we have enought information to create our first service interface (based on the Night) and your test case for the further service implementations.

So your first service will look like this:

public interface NightService {

/**
* Add a new night to the store. If the night is supplied with an ID it will be replaced.
* After the call to the registerNight method the Night object will have the ID filled.
* @param night night to be added.
*/
public void registerNight(Night night);

/**
* Replace the night stored. The provided night should have the id filled in order
* to have the date replaced correct.
* @param night night to be replaced.
*/
public void changeNight(Night night);

/**
* Returns the night by its unique identifier
* @param nightId identifier of the night.
* @return
* Night object, null if there isn't any night for that id.
*/
public Night findById(String nightId);

/**
* Returns the list of nights of the specified day of week.
*

    *
  1. The order returned by the find week day should be from the first include to the last one.

  2. *

* @param dayOfWeek
* @return null when there isn't any night for the specified day of week, otherwise a list with the nights.
*/
public List<Night> findWeekDayNights(DayOfWeek dayOfWeek);

/**
* Returns the list of nights of the specified name, the name match is not case sensitive.
*

    *
  1. The order returned should be from the first include to the last one.

  2. *

* @param dayOfWeek
* @return null when there isn't any night for the specified name, otherwise a list with the nights.
*/
public List<Night> findNightWithName(String nightName);

/**
* Returns the corresponding night for a specific day.
* @param date date of the night
* @return
* Night corresponding to the date, if there isn't any night for that day then returns null.
*/
public Night nightOf(Date date);
}


Based on this service let's created a test case to test all your service implementations. This test case is to make sure that all the services methods are working properly, after that we will be able to start executing your desired tests.


public class NightServiceTest {

private NightService nightService = null;
private TestUtils testUtils = null;

//... Code removed for simplicity

@Test
public void testRegisterNight() {
Night movieNight = testUtils.createNight(DayOfWeek.MONDAY, "MOVIE_NIGHT");
nightService.registerNight(movieNight);
Night movieNightRead = nightService.findById(movieNight.getId());

assertEquals(movieNight, movieNightRead);
}

@Test
public void testChangeNight() {
Night gameNight = testUtils.createNight(DayOfWeek.TUESDAY, "GAME_NIGHT");
nightService.registerNight(gameNight);

gameNight.setName("Man this is the really the GAME night");
nightService.changeNight(gameNight);

Night gameNightRead = nightService.findById(gameNight.getId());

assertEquals(gameNight, gameNightRead);
}

@Test
public void testFindNightById() {
Night wOwNight = testUtils.createNight(DayOfWeek.WEDNESDAY, "WOW_NIGHT");
nightService.registerNight(wOwNight);

String validId = wOwNight.getId();
String invalidId = "invalidId";

Night validNight = nightService.findById(validId);
assertNotNull(validNight);
assertEquals(validId, validNight.getId());

Night invalidNight = nightService.findById(invalidId);
assertNull(invalidNight);
}

@Test
public void testFindWeekDayNights() {
//Create the nights
Night bownlingNight = testUtils.createNight(DayOfWeek.FRIDAY, "BOWNLING NIGHT");
Night arcadeNight = testUtils.createNight(DayOfWeek.FRIDAY, "ARCADE NIGHT");
Night kartNight = testUtils.createNight(DayOfWeek.FRIDAY, "KART NIGHT");
Night pizzaNight = testUtils.createNight(DayOfWeek.THURSDAY, "PIZZA NIGHT");

nightService.registerNight(bownlingNight);
nightService.registerNight(arcadeNight);
nightService.registerNight(kartNight);
nightService.registerNight(pizzaNight);


List<Night> mondayNights = nightService.findWeekDayNights(DayOfWeek.MONDAY);
List<Night> tuesdayNights = nightService.findWeekDayNights(DayOfWeek.TUESDAY);
List<Night> wednesdayNights = nightService.findWeekDayNights(DayOfWeek.WEDNESDAY);
List<Night> thursdayNights = nightService.findWeekDayNights(DayOfWeek.THURSDAY);
List<Night> fridayNights = nightService.findWeekDayNights(DayOfWeek.FRIDAY);
List<Night> saturdayNights = nightService.findWeekDayNights(DayOfWeek.SATURDAY);
List<Night> sundayNights = nightService.findWeekDayNights(DayOfWeek.SUNDAY);

assertNull(mondayNights);
assertNull(tuesdayNights);
assertNull(wednesdayNights);
assertNotNull(thursdayNights);
assertNotNull(fridayNights);
assertNull(saturdayNights);
assertNull(sundayNights);

assertEquals(thursdayNights.size(), 1);
assertEquals(fridayNights.size(), 2);

assertEquals(pizzaNight, thursdayNights.get(0));

//The order returned by the find week day should be from the first include to the last one.
assertEquals(bownlingNight, fridayNights.get(0));
assertEquals(arcadeNight, fridayNights.get(1));
assertEquals(kartNight, fridayNights.get(2));
}

@Test
public void testFindNightWithName() {
Night surprise_Surprise_Night = testUtils.createNight(DayOfWeek.MONDAY, "SURPRISE SURPRISE NIGHT");
Night big_Surprise_Night = testUtils.createNight(DayOfWeek.MONDAY, "BIG SURPRISE NIGHT");
Night surprise_surprise_Night = testUtils.createNight(DayOfWeek.MONDAY, "suprise surprise NIGHT");
Night double_Night_one = testUtils.createNight(DayOfWeek.TUESDAY, "DOUBLE NIGHT");
Night double_Night_two = testUtils.createNight(DayOfWeek.TUESDAY, "DOUBLE NIGHT");

nightService.registerNight(surprise_Surprise_Night);
nightService.registerNight(big_Surprise_Night);
nightService.registerNight(surprise_surprise_Night);
nightService.registerNight(double_Night_one);
nightService.registerNight(double_Night_two);

List<Night> nightsRead = nightService.findNightWithName("SURPRISE");
assertNull(nightsRead);

nightsRead = nightService.findNightWithName("SURPRISE NIGHT");
assertNull(nightsRead);

nightsRead = nightService.findNightWithName("SURPRISE SURPRISE");
assertNull(nightsRead);

nightsRead = nightService.findNightWithName("SURPRISE SURPRISE NIGHT");
assertEquals(nightsRead.get(0), surprise_Surprise_Night);
assertFalse(nightsRead.get(0).equals(big_Surprise_Night));
assertFalse(nightsRead.get(0).equals(surprise_surprise_Night));

nightsRead = nightService.findNightWithName("BIG SURPRISE NIGHT");
assertFalse(nightsRead.get(0).equals(surprise_Surprise_Night));
assertEquals(nightsRead.get(0), big_Surprise_Night);
assertFalse(nightsRead.get(0).equals(surprise_surprise_Night));

nightsRead = nightService.findNightWithName("suprise surprise NIGHT");
assertFalse(nightsRead.get(0).equals(surprise_Surprise_Night));
assertFalse(nightsRead.get(0).equals(big_Surprise_Night));
assertEquals(nightsRead.get(0),surprise_surprise_Night);

nightsRead = nightService.findNightWithName("DOUBLE NIGHT");
assertEquals(nightsRead.size(), 2);
assertEquals(nightsRead.get(0), double_Night_one);
assertEquals(nightsRead.get(1), double_Night_two);
}

@Test
public void testNightOf() {
//24.12.2010 is a friday
//29.02.2012 is a wednesday
//15.05.2010 is saturday
//22.05.2010 is saturday
Night gameNight = testUtils.createNight(DayOfWeek.FRIDAY, "GAME NIGHT");
Night thaiFoodNight = testUtils.createNight(DayOfWeek.WEDNESDAY, "THAI FOOD NIGHT");
Night feverNight = testUtils.createNight(DayOfWeek.SATURDAY, "FEVER NIGHT");

nightService.registerNight(gameNight);
nightService.registerNight(thaiFoodNight);
nightService.registerNight(feverNight);

Calendar _15_05_2010 = Calendar.getInstance();
_15_05_2010.set(Calendar.DAY_OF_MONTH, 15);
_15_05_2010.set(Calendar.MONTH, Calendar.MAY);
_15_05_2010.set(Calendar.YEAR, 2010);

Calendar _22_05_2010 = Calendar.getInstance();
_22_05_2010.set(Calendar.DAY_OF_MONTH, 22);
_22_05_2010.set(Calendar.MONTH, Calendar.MAY);
_22_05_2010.set(Calendar.YEAR, 2010);

Calendar _24_12_2010 = Calendar.getInstance();
_24_12_2010.set(Calendar.DAY_OF_MONTH, 24);
_24_12_2010.set(Calendar.MONTH, Calendar.DECEMBER);
_24_12_2010.set(Calendar.YEAR, 2010);

Calendar _29_02_2012 = Calendar.getInstance();
_29_02_2012.set(Calendar.DAY_OF_MONTH, 29);
_29_02_2012.set(Calendar.MONTH, Calendar.FEBRUARY);
_29_02_2012.set(Calendar.YEAR, 2012);

Night night_24_12_2010 = nightService.nightOf(_24_12_2010.getTime());
Night night_29_02_2012 = nightService.nightOf(_29_02_2012.getTime());
Night night_15_05_2010 = nightService.nightOf(_15_05_2010.getTime());
Night night_22_05_2010 = nightService.nightOf(_22_05_2010.getTime());

assertEquals(gameNight, night_24_12_2010);
assertEquals(thaiFoodNight, night_29_02_2012);
assertEquals(feverNight, night_15_05_2010);
assertEquals(feverNight, night_22_05_2010);
}
}


Next we will make our first implementation of this interface, using a relational database.

See you soon!

terça-feira, 11 de maio de 2010

High availability: defining the terms

It is quite common to see a lot of places talking about availability, how to make your website, program, web service, etc, 24x7.

Even here I talked few times about this subject, but what I miss is some papers discussing the meanings of the terms in this area. A kind of a common language that we can talk about, I know that it depends a lot of your environment, company, software and so on. So in this post I would like to put some light in this subject.

Last month IBM release one of their famous Redbooks (I remember a time that an IBM Redbook was a kind of: "OHHHH really do you have one!, but those times are over with the floppy disks): High Availability in WebSphere Messaging Solutions.

No, I am not doing advertisement about the IBM products, it has an excellent part about concepts, so it really worths reading the Chapter1. Introduction to Availability and Chapter2. Application Design for Availability.

There is a lot of concepts and therms definition that will help you a lot, doesn't matter if you are implementing something in your own software, designing an application, for general knowledge. For me it is a must read for developers, architects, software development support team and so on.

Hope you enjoy the tip!

sexta-feira, 30 de abril de 2010

Thoughts about Document Oriented Databases - part 2

In the first post I presented some issues that I would like to investigate concerning the Document-Oriented Databases. Now I am going to introduce you with the User Story that I will use as basis for that, so "Sit! Here comes the story!".

Let's imagine a group of geek-nerd-friends, every week day they do something during the night. They have the Halo night, the comic store night, the movie night and so on, a full life. Because of that one of those guys wants to manage the nights, they want to know for each night: the participants, the activities of each one, time of those activites, how much people are involved in each activity and which nice widgets they have to use for those activities.


So let's write our first use story (I will give to the user stories some short name to simplify further references):

PYTHAGORAS: As a nerd, I want to organize the night and distribute the activities of that night across all my nerd friends.
  • All the nights have a name, like Halo night or Comic store night.
  • It always happens in a specific day of the week, like Halo night is always on wednesday.
  • To have a nice night we should execute a group of activities (buy food, bring the game, etc).
  • Each activity has one responsible.
  • Each activity could need the help of 1 or more people.
  • Each activity could require one or more widget to be executed (using the iPhone to find the pizza store, the teleport machine to arrive in time, etc).
  • Each activity should be done to have a nice night.
  • A night is ready to start when all the activities are done.

Based on this user story we can create this base class diagram:


These classes will be improved over the time, but with the current information is what we can create.

To understand the class model, here is the test case of the Night::isNightReady() method, it will help to understand what a Night and an Activity is:


@Test
public void testIsNightReady() {
Night saturdayNightFever = new Night();
saturdayNightFever.setDayOfWeek(DayOfWeek.SATURDAY);
saturdayNightFever.setName("Saturday Night Fever revival night!");

//No activities means that the night is read to start
assertTrue(saturdayNightFever.isNightReady());

//Let's add a list of activities in the night
List<Activity> activitiesOfTheNight = new ArrayList<Activity>();
saturdayNightFever.setActivityList(activitiesOfTheNight);
assertTrue(saturdayNightFever.isNightReady());

//For a saturday night fever we need to practive dance listening the BeeGees K7
Activity practiceDance = new Activity();
practiceDance.setWhatShouldBeDone("Dance listening BeeGees K7");
practiceDance.setResponsible("me");
saturdayNightFever.getActivityList().add(practiceDance);

//And also get the nice white suite
Activity takeTheSuite = new Activity();
takeTheSuite.setWhatShouldBeDone("Take the white suite at mother's house");
takeTheSuite.setResponsible("me");
saturdayNightFever.getActivityList().add(takeTheSuite);

//And finally meet the girl
Activity meetTheGirl = new Activity();
meetTheGirl.setWhatShouldBeDone("Meet the girl at his house");
meetTheGirl.setResponsible("me");
saturdayNightFever.getActivityList().add(meetTheGirl);

//I have done none activity, so the night is not ready to start
assertFalse(saturdayNightFever.isNightReady());

//I've found the K7 and danced a lot, but still not ready.
practiceDance.setDone(true);
assertFalse(saturdayNightFever.isNightReady());

//Got the old father's white suite at moms house
takeTheSuite.setDone(true);
assertFalse(saturdayNightFever.isNightReady());

//Meet the girl
meetTheGirl.setDone(true);

//Now it is time to ROCK
assertTrue(saturdayNightFever.isNightReady());
}


And finally I have set a project at GitHub: TADOD, so I will keep publishing the code there.
It is a maven project, so it should be easy for everyone to download it and run. All the entries in the blog will be present in the project site (just need to execute mvn site).

In the next post I will define the interfaces of the services, so we will be able to create the test cases and later start your analysis.

See you soon, and have a nice 1st of May (beware of the Punks around).

terça-feira, 27 de abril de 2010

New pattern - The Match Marker Design Pattern

Yes that is true, the GOF Design Pattern book is not the bible of the OO design patterns; it is just The Book of Genesis, the beginning but it is far away of the end. In fact new problems, causes new common ways to solve them and at a final stage new patterns.

In a recent article Michael Bar-Sinai presents a new pattern The Match Marker Design Pattern, which has the intention to solve similar problems to the Visitor pattern. The main idea of this pattern is to solve the situation where you want to extend the action applied to your business objects in a better and clear way than just extending objects.

Let's suppose this problem (well it is the same one presented by Michael, I guess it is easier to show the same): you have an Employee and needs to calculate the salary of it, as type of Employee we have Manager and Engineer. How to solve this problem? Create a salary calculator that has a method that checks the instance of the class to calculate? Does allow the Employee to return the salary and overwrite it for each class?

Well take a look at this pattern: it is a interesting way to solve the problem: The Match Marker Design Pattern.
For those that want to remember the Visitor pattern, here it goes an article explaining it: Design Patterns Uncovered: The Visitor Pattern.

Enjoy it!

terça-feira, 20 de abril de 2010

Java in the factory field

Back to the middle of 2003 I have spent sometime reading and investigating how to use Java in the factory field, based on some standards like Fieldbus, Profibus, Supervisory Systems and so on. It was an early time, a time that I was walking in green fields but without money or contacts to transform the research in something more concrete.

Not that nowadays I have contacts or money, in fact I am not even in the green fields anymore, but looking at my old papers and pdfs I have found those documents. And it brought me some curiosity where was the state of things in this area; back to that time we had a lot of papers, researches but no real implementation in the factory fields itself; it was still the realm of C programmers.

For my disappointment a brief search and inspection proved that Java hadn't stepped forward in most of these areas, but a work demonstration at JavaOne 2007 looked really promising. It is an industry robot automation using merely JAVA, for sure it is using the Real-Time Specification for Java 2.0, as we need a more strict control over what is happening in the machine.
It is used on top of a bus standard called EtherCAT, which is a kind of bus that communicates over Ethernet and not some serial protocol.

The main point here is to see that it is possible to have Java running in a critical environment that needs time based response in a preemptive mode. By the way if you want to see the robot in action just go for this video World's First Java-Controlled Industrial Robot



For those that want to remember about industrial bus here is collection of wiki pages that could helpful:
- Fieldbus (http://en.wikipedia.org/wiki/Fieldbus)
- EtherCat (http://en.wikipedia.org/wiki/EtherCAT)
- Profibus (http://en.wikipedia.org/wiki/PROFIBUS)

And finally the paper Using Real-time Java for Industrial Robot Control that has an overview about the robot implementation with java.

I hope you enjoy it as a new curiosity area or make you remember old hard working days!

quarta-feira, 14 de abril de 2010

Where is your coin?

Some time ago people used to believe that you should bury a person with a coin in his mouth in order to pay the ship (or at least to guarantee a good place in the ship) to the land of the death.
If even in the land of the death, in the other world, there isn't free entrance, imagine here, imagine in the software's land. In a nutshell: there isn't free lunch. But why all this death, lunch talks; are you hungry? Are you afraid of dying?

No, absolutely not! The question is that people still think as new technologies as a free lunch, something like, an all around solution. If you need speedy them you should let it go the versatility, if you want all around solution them forget the speedy and welcome to the complexity nightmare; the blanket is not big enough for everyone.

I guess that all of you already heard about those Agile things like XP, Scrum and others, they are not really the same thing but all of them propagate the idea of: postpone as much as you can the decisions, most of the time you will realize that they are not needed or you will have the enough knowledge to do it right; I completely agree with that (by the way it doesn't means that the decision should not be made or it should be a no meaning decision, like a lot that we see around).

And them you come to NoSQL alternatives, quite flexible and it seems to fit so smoothly that it is like a temptation. No schema, you are so free to change it that you can even have different versions of data in a productive environment, really nice. Do you remember that we need to give the coin to the punter? Well, the NoSQL is a really light because of the simplicity of its schema, no rules, but it has a cost, the queries.
Once you go for this kind of solutions you need to pay in the queries, you don't have the power of the relational databases here. If in one end you don't need to think about the schema in the early beginning at the other end you DO need to think about how you are going to look for that information in the future.

Most of those solutions requires you to duplicate data if you want two different queries at the same time, or you need to create a view that will be your query, or simply no query at all, just a sequential access to the data (in a predefined order). The benefits? Fast, light, easy to distribute, but you need to pay a price for that.

So are they not really going to work in the real world? Absolutely not! Do not misunderstand me, they have a place, and I guess a big one. But we need really to understand what kind of application we are going develop, in the early beginning to know if it fits or not, and to address the needs of the technology.

The point here is: you need to know with whom you are dealing; do not take only the nice words of Agile and NoSQL; otherwise you will fall in the sing of the sirens and your ship will crash the rocks of reality.

As usual I will let a link here, I guess it will help you all to clarify what I am talking about the drawn backs of the NoSQL technology (in this case Cassandra): WTF is a Super Column

terça-feira, 30 de março de 2010

For those that like to post videos and presentations

Hi all! There is a new portal (at least for me) that you can post your presentations with the presentation itself.

Let's suppose that you participated of an event with a speech and want to put it online, so in the same time that you say you can sincronize your "wonderful" power point!

Check it out: Parleys.com

I will be waiting for your content there!

segunda-feira, 29 de março de 2010

New IDE concept. Finally something new!

Last Saturday I was having breakfast with IT posts and I found this really interesting post Code bubbles. Ide Revolution.

The post is an interview with the guy that is working on this IDE concept as a thesis. The interview is a little bit long so if you want to go directly to the point and see what it is about take a look in the video available in the project overview page, or for those unable to see the video here is the details page with some images and explanation.

Hope you enjoy it. New ideas for the new week!

sexta-feira, 26 de março de 2010

Jazz

Today I am going to move from the usual coding subjects to something more related to process. I guess that the Rational suite is well know for most of us, together with the Rational suite there is the Unified Process concept (in a creational point of view: first the man created the Unified Process, he looked and it was not that good, then he created the RUP and it was ok, but the desire for more make him create the Rational suite – and now he is ashamed for the rest of his life).

I am not here to discuss the quality of the Rational Suite (which I am not a fan) or the Unified Process (which I am sure is misunderstand process), but I want to bring to you a new initiative from IBM the Jazz.

According to the IBM Jazz website, this initiative could be define as: "…Jazz is an initiative to transform software delivery by making it more collaborative, productive and transparent, through integration of information and tasks across the phases of the software lifecycle".

Jazz is a set of concepts and, of course, a group of IBM products; you can think about those products as an evolution of some Rational products. But in this case I guess with some major differences (in the direction of the Sun): it has an open source architecture, which means that you can plug any external software to work with it (open ground to open source software) and it has a community portal. The portal has a lot of information, so you do not get stuck with some guru-guys saying what should be done and what not, no more high cost guys or information blockage. I am not saying that everything is for free, but the community can grow by itself.

A nice set of products, the community process is not new, but is always good to see people getting into it, mainly in the area of process where the community idea is not really easy to accept. But the most important part, in my humble point of view, is the move to some agile process. You absolutely do not see anything in the Jazz.net saying about Scrum, Agile, and so on, that is absolutely true – what is ok because it is just products and you can use it with the process that you like most.

If you watch the videos in the portal you will notice what I am talking about. For example this video: the Collaborative ALM Demo – The Jazz Revolution tells a nice story that has a happy end because of the Jazz. But is it true? I don't think so; I have counted 2 times the agile word, 2 times continuum integration and 14 times the Iteration word, plus N points in this iteration and so on. If it is not something similar to Scrum I don't know what it is.

The point here is: nice tools help but do not solve our problems and the same time that short iterations, real scope review, communication, real information that serves as input for the work, test cases and other stuffs that makes the big wheel turn helps much more.

In a more philosophical way of thinking: a beautiful ring (the tool) is still just a ring without a gentle hand (the process) to have it, and I can imagine much more uses for a gentle hand than to a ring.

sexta-feira, 19 de março de 2010

Initial Experience

Yesterday we "finally" deployed in production a version of the software that took quite a long time to go. And thinking about it come to my mind a article that I read in IBM portal talking about Initial Experience.

When we find ourselves developing software for "internal" costumers is quite easy to forget that your software could cause a good/bad impression at the user, mainly if it is a brand new software, or those long time expected releases. The common thought is: why should we botter about it when the costumer has just one option: accept it or accept it; but thinking in this way doesn't make your product better I can insure you.

A serie of articles from IBM bring some ideas about this Inital experience of the users with the software. The initial experience is just a relation between the user expectation with the product and what he really get from it.

For sure it is not a simple matter, because we have differente level of users, uses of them in the product and so on, for example: is this user a novice or an expert?
Which are the factors that we should consider in this inital experience? And so on.

So take a look in the articles, read about it and next time that you are going to make a deploy of something new, think about it. It could be the difference between a easy life in the following weeks or the opening of the hell's gates.

IBM Design: Inital experience

And remember: the first kiss is that really matters ;-) Nice weekend.

segunda-feira, 8 de março de 2010

Thoughts about Document Oriented Databases

These last two weeks I have read many articles about Document-Oriented databases, for sure they have potential and also it is true that it is not the panacea to all our problems.

After so many readings I started to think about some scenarios were this kind of databases could be applied in a efficient way. Efficient way is a too generic definition, so before highlighting the scenario I would like to clarify the elements that I would like to investigate.

I want to divide it in two parts: developing and performance. In the developing area I want to find out:
  1. The effort to create the access layer;
  2. Due the document/object changes across the time, how much is the effort to migrate the data? Is it necessary to migrate the data or can we have a base with different documents version?

In the performance area I want to find out:
  1. How much time is spent in a single insert?
  2. How much time is spent in a single update?
  3. How many concurrency inserts can I have?
  4. How many concurrency updates can I have?
  5. How fast is a list query of the documents ?
  6. How fast is a list query of the documents during a sequence of inserts?
  7. How fast is a list query of the documents during a sequence of updates?
  8. Execute all those performance tests in a single node DB and a multi node DB.

With this analisys I would expect to have a better understanding of the Document-Oriented model, in development area and in the application runtime.

Ok. Now is time to define the scenario that I would like to evaluate this parameters. Let's suppose that you have an application that is a workflow based in a document.
This document is a set of information offered to your user/client, and as expected this document has a structure (as complex as your business). Let's ignore the workflow part and stick in the document.
  • We need to have the basic 4 operations for the document: create, read, update and delete (CRUD), plus a view of the list of the documents (with a small set of the data);
  • All the CRUD operation is executed at the document level and not at parts of the document;
  • The whole application uses the this base API, so every update/insert is make in the complete document.
  • It is done like this to simplify the API and due the fact the user interface to insert/update the information is build at runtime (I can have everything or just few fields).
Well this is the base scenario that I would like to investigate, it is because in my point of view the Document-Oriented database would fit here much better than the standard relational database.

In the next post I will step into the document definition and the user stories that I would like to implement in order to start the investigation.

See you soon.

sexta-feira, 5 de março de 2010

Opinion about NoSQL coming from a DB guy

This week I didn't have much time to write a nice blog, some ideas but nothing concrete. As usual on Friday I am trying to post something more light, so today I am going to post a presentation of Brian Aker about the NoSQL trend.
It is a 7 minutes video with some jokes about this idea.



Enjoy it :-)

segunda-feira, 1 de março de 2010

When the code talk to you...

People say that we can find the answer for our question in the smallest thing of the life, that could be true, but what should we do when instead of answer we find questions? And when those questions are in the code that you are working with? What should we do?

From time to time I find some questions in the comments of the code, I always look at it wondering if someone will ever answer them, or even if I answer it then someone will read it? Will I get another question? Will the code chat with me?

As I don't pretend to have all the answer of the world I am posting some questions here, so you all could help me with this important task: answer questions posted in code comments!









And remember: don't let your code without answer, so if you find any question flying around, please answer it or send it to me. I will post it here and then we can answer all those questions, once the question about the life, universe and everything else is already answered (and everyone knows that it is 42).

Have a nice week.

sexta-feira, 26 de fevereiro de 2010

Development, music and the 80s

Today is Friday! It is usually a day for going out drinking something, listening some music, having some fun.
It is difficult to find someone that doesn't like this kind of thing, isn't it? I usually develop listening to music, tying to have some fun too (all of this just to say that I listen to music).

Yesterday was thinking about what to write today in the blog, a lot of nice topics end up in my mind, but in the between a match and the other in the Winter Olympic Games I zapped to a channel with a 80's marathon. Everyone that remember the 80's movies knows that they have a lot of music, kind of ridiculous clothes and a lot of teenagers.
But listening to them I notice a lot of similarities with your developer day life, I don't know if it is because the personal computer are a boom from the 80's too or just a trick of the destiny, but it is unbelievable how those music says about your job.

Here I will add parts of some lyrics and you will see (ok not all of them are from the 80s, but come on everything has a beginning)

Customer asking for a new project
I need a hero

He’s gotta be strong
And he’s gotta be fresh from the fight

He’s gotta be sure
And it’s gotta be soon
And he’s gotta be larger than life

Somewhere after midnight

- I need a hero "Bonnie Tyler"



About that last minute change request

Who's gonna tell you when,
It's too late,

You can't go on, thinkin',
Nothings' wrong, but bye

- Driver "The cars"
A ever standing request in the list?
Its my own design
...
I can't stand this indecision
Married with a lack of vision
- Everybody Wants to Rule the World "Tears for fears"
A new incredible "never-ever-though" feature rises
What is it good for
Absolutely nothing
Say it again
...
What is it good for
Absolutely nothing
- War "Edwin Starr"
A good UI interface
More than just blind ambition
More than just simple greed
More than just a finish line
...
Like a streak of lightning
That flashes and fades
...
More than high performance
More than just a spark
More than just the bottom line
...
- Marathon "Rush"
Trying to avoid that 90 degrees change on the project
But it's gonna take money
A whole lotta spending money
Its gonne take plenty of money
To do it right child

Its gonna take time
A whole lot of precious time
Its gonna take patience and time, ummm
To do it, to do it, to do it, to do it, to do it,
To do it right child
...
- Got my mind set on you "George Harrison"


Fell free to send me any nice music that you think represents oour day life. I will try to make this post more often!

Enjoy the day! Enjoy the life!

segunda-feira, 22 de fevereiro de 2010

Branch per feature

Last Friday I have read an article from Mr. Martin Fowler about VCS, focusing in Distributed Version Control System. Although it is an interesting topic, I guess it is a kind of technical discussion if it should distribute or not.
Before someone wants to shoot me, I know that there are advantages over a central system, but the point is that I don't want to highlight it here.

Actually it is much more interesting all the patterns that emerged with this kind of VCS, not because they didn't existed, just because the DVCS makes then simple. So ladies and gentlemen I would like to introduce you the amazing Spider-man!!! Ops… wrong introduction… I would like to introduce you the Feature Branch technique (a.k.a Branch-Per-Feature).

The main idea of this technique is: every new Feature of your software becomes a branch in the version control system, and as soon as this feature is implemented the branch is merged to the baseline. Simple isn't it? There are quite few advantages in this technique, the main one (in my point of view) is that you can release the software with the desired features as soon as they are available.
For example, if you have 3 features on the go, but one of them is important and should be released right now then, just merge it to the baseline and you are ready; the other features are no impacted and your delivery do not need to wait for that.

I don't need to say that to have it working like a charm, continuous integration is a must.

There are two really good articles about it, the first is an introduction about it by Martin Fowler and the second is a How-To about implementing this kind of technique.


I really got enthusiastic about this kind of source control technique, it is really usefull if you are interested in selling services and not software, so for you last minute services are almost a must.

Have a nice week.

quinta-feira, 18 de fevereiro de 2010

Continuations

Yesterday I spent quite few time trying to solve some problem related to old data stored in the webapp session. It made me remember a similar situation few years ago, when I had hard time with the same problem (not that it just happened twice, but those two times were quite remarkable).
But there is a small difference between those two situations, a small difference that makes all the difference.

In the early days I was dealing with a kind of application similar with those online selling: a lot of pages that you must commit the information only at the end. So the use of the session, although not mandatory is almost 100% of the choice. But the application of yesterday is the opposite: it should commit the changes all the time, almost at every breath of the user; but again we are using the session.

I remember myself thinking how it would be nice and simple to get free of the session, all those synchronization problems, back button problems and so on. And now I have an application that could act like saving all the time, but still we are stick with the session. Why?

Well I don't have the answer but I guess it is just a question of old habits, justified by the performance of using the session. And that is my point: is the session the best high performance solution?

Well, I would like to have numbers about it (maybe in a future post), but it is well spread the idea that session is an enemy to scalability. It makes all the sense, but a non-session world looks like to be impossible outside of the books.

I do not advocate about killing the session, no!, but a better management of it is crucial for: a better performance application (memory leak can kill an application more easily than a slow response time) and a smooth programming (spend hours trying to find out why things do not match is not nice).

As I said in the beginning, it is just a way home though, but it deserves some kind of investigation, what the world thing about this subject. Despite of the REST way of doing things (which we can discuss later) I have found a nice third wave, something that they claim to be Statefull programming model for a stateless world: Continuations.

I would explain it here, but there is nice article at IBM which can do this job much better Crossing borders: Continuations, Web development, and Java programming.

I hope you enjoy the reading; maybe it could make you less angry next time (knowing that there is a brighter life out there).

terça-feira, 16 de fevereiro de 2010

Patterns of Deployment

Today I was looking at a Javalobby post, that highlight some deployment tools. Between those tools there is a interesting one called SmartFrog (java based and developt by HP, yes it is true, these guys still have some projects).

SmartFrog is a powerful and flexible Java-based software framework for configuring, deploying and managing distributed software systems.

Take a look if you want, but the main idea of this post is to invite you to see one of the SmartFrog wikipage: Patterns of Deployment.

In that page you will find nice patterns to deploy application, some address by SmartFrog, some not. But the main idea of this page is to show you the possible patterns and tools for that.

I am sure that you need to deploy your application and maybe creating the .WAR is not enough or that easy ;-)

sexta-feira, 12 de fevereiro de 2010

It is in the corner, just waiting to spook you!!!

Today is friday, carnaval is close (although I am not going to have holidays, but it is ok, I hope someone will enjoy it for me), so I will not talk about boring stuffs like datastores, performance, why the world is not green enough, why my house does not have a auto-clean button and so on.

The post of today is just to invite you all to take a look in another post, from Joel Spolsky, "The Law of Leaky Abstractions".

I am sure that it is something that you already know, feel it in your heart, but it is nice to see someone writing about it. The example about actors travel is quite good :-)

I hope you all enjoy and have a nice Carnival/Fastnacht (hope it is right guys :-)

quarta-feira, 10 de fevereiro de 2010

Key-Value stores

To finish the posts about different kind of storage mechanisms I would like to introduce you to the Key-Value datastore.
A key-value datastore is nothing more than a BIG hash table that is able to persist the data in the disk. So why is it interesting? Why would it count as a remarkable datastore?

For sure it is not a new technology or even a new concept, but your Google friends brought it to light doing map reduced processing over key-value datastores. This kind of store is easy to persist, easy to distribute over many nodes (ok there is a lot of technology behind it, but still easier and faster than a relational Database).

I know that it looks like a geek subject, but if you think about the kind of applications that you have, you will find something that will fit in this concept, and maybe you are using relational databases and a lot of tricks for that.

For the moment I would just like to make a note about this subject, but for sure I will return to comment about it (maybe with some examples).

For the time, if you are interested in it, please refer to these projects:
- Keyspace : the whitepapers of this projects give you good idea how it works and where you can apply it;
- Voldemort : a promising datastore (used by linkedin).
- Richard Jones had made a nice post with comments about key-value datastores, much deeper than this one. Please pay a visit really good reference about the subject: http://www.metabrew.com/article/anti-rdbms-a-list-of-distributed-key-value-stores/.


Hope it could trigger some lights for you as it had for me :-)

segunda-feira, 8 de fevereiro de 2010

Document-oriented databases

In the last post I have talked about Graph Databases, and today I will keep in the same direction and talk about another kind of database: Document-Oriented database.
A document-oriented database is not a Content Manager system, although some similarities. Usually this kind of database could be view as a KEY-VALUE database, where the key is a unique id (handled by the database) and the value is your document.
The way that the document is described can vary from database implementation but currently the most accepted format is JSON; also the databases offers good query and indexing features to make this data workable in real applications.

This kind of database can be really handful for applications with documentations that evolves among the time and they all can exist at the same type. As the Graph Databases it is not a replace for relational databases, it is another way to store and structure your data; and a way that can be really good for common data store applications.

I would like to end the post with three links, it is a good start to understand how document-oriented database works:
  • http://www.mongodb.org: MongoDB (from "humongous") is a scalable, high-performance, open source, schema-free, document-oriented database (thanks Tiago for the tip for this database).
  • http://couchdb.apache.org/: Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript. CouchDB also offers incremental replication with bi-directional conflict detection and resolution.
  • http://books.couchdb.org/relax/: CouchDB: The Definitive Guide (to understand a little bit more about this kind of the database, read the Introduction).

See you in the next post!

sexta-feira, 5 de fevereiro de 2010

Graph Database

Graph database are not about images or graphs and things like that :-). They are simply a database organized as a Graph, you don't have tables, you just have nodes and relations.
Interesting concept that can be applied in some kind of structure that we could need to have work with.

Too conceptual? Well I suggest you to take a look at the project Neo4j project. It is a java project that implements a graph database.
Take a look, investigate the examples, I am sure that you will find where to apply it easily (at least you will know that there is another option to your good friend Relational Database).