Posts Tagged ‘Java’

Dev in Rio 2009, a great software development conference in Rio de Janeiro!

Friday, December 4th, 2009

Even though it was conceived, planned and executed in a little bit more than 20 days, Dev in Rio 2009 was awesome, a huge success! We had around 400 people at the SulAmerica Conventions Center in my home town Rio de Janeiro talking about software development, programming at the Coding Dojo and having a lot of fun in a whole day of presentations that ended in the biggest #Horaextra ever. “Hora extra” (which means “Overtime”) is the name of our weekly meeting where the nerds hang out together to drink and have a nice chat about geek stuff.

Dev Rio in 2009 started at the scheduled time when me and my friend Henrique Bastos (the creators of the conference) opened the event with a quick presentation and thanking our sponsors, supporters, communities and friends who helped us a lot more than you can imagine.

Dev in Rio 2009 - Abertura
* Henrique Bastos and me at the Dev in Rio opening.

To begin the day, we started the two tracks of Dev in Rio 2009. At the main auditorium we had the scheduled lectures while in the foyer we had the Coding Dojo.

Coding Dojo is a programming arena that was organized by the Dojo Rio folks in partnership with Dojo@SP. The idea is to work on simple and novelty problems, using programming techniques like Test-Driven Development and SOLID principles. This was definitely the best surprise we had in the day – the Dojo went much better than we could ever imagine (except that the Java Dojo wasn’t much popular, I have to admit).

Dev in Rio 2009 - Coding Dojo
* Coding Dojo at Dev in Rio: 3 meters of code on the wall!

Dev in Rio 2009 - Coding Dojo
* People participating at Dev in Rio’s Coding Dojo.

The first talk of the day was given by Ryan Ozymek, that entered the stage with his famous penguin to talk about his experience with open source software and the Joomla! community. He detailed how a big software development community works and gave his entrepreneur vision about how to use open source software to leverage businesses.

After that, Guilherme Silveira and Nico Steppat talked about a very controversial theme: Is Java dead? They addressed the fact that there are many things beyond the language in the Java universe and that despite the language is “expiring” the JVM can still be very useful.

After lunch, Fabio Akita gave no respite for anyone who was sleepy and did an excellent presentation on the Ruby on Rails ecosystem, with excellent videos, screen casts and quite information beyond the code. He doesn’t know but he took away the breath of the simultaneous translation girls!

Continuing, the (almost carioca) Jacob Kaplan-Moss made his presentation on Django, that he calls “the web framework for perfectionists with deadlines”, developed in Python. He spoke about the concepts and values that guided the development of the project and showed a bit of code to give the audience an idea of how to use the basics of Django.

The last presentation of the day was given by Jeff Patton, that talked about product development with Agile methods. Using as a narrative the story of a project carried out in conjunction with Obie Fernandez, several common problems in software development (and their solutions) have been addressed.

In the end, our great friend Vinicius Manhães Teles led an interesting conversation between speakers, communities and the audience. We had the impression that if we didn’t control the time, the conversation would have taken hours and hours because there were a lot of interesting subjects and questions. The audience took a great deal and we had interesting topics like entrepreneurship and controversial as the stupid regulation law of the systems analyst profession proposed by the Brazilian government (in Portuguese only).

Dev in Rio 2009 - Discussion
* Discussion led by Vinicius Teles. And before anybody asks, no, that one on the picture is not Adam Savage from MythBusters, it’s Jeff Patton.

While all these things were happening, me, Henrique, Gustavo Guanabara and Flavia Freire (Arteccom‘s journalist) spent the day recording a huge podcast of the event, interviewing staff and filming the scenes. We have talked with the speakers, sponsors and attendees about all the subjects addressed on the talks! Watch the “making of” of some Podcasts with Ryan Ozimek, with Guilherme and Paulo Silveira and with Fabio Akita and Marcos Tapajós.

Dev in Rio 2009 - Podcast recording
* Guanabara recording the Podcast with Fabio Akita and Marcos Tapajós (and a neat detail: Guilherme Silveira and Paulo Silveira doing Pair Programming just behind them).

Since the event was realized on a monday, we ended the conference inviting everybody (with the “Estamos todos bêbados” song from Matanza in the background and choreography by Sylvestre Mergulhão and Henrique Andrade) for an epic edition of #Horaextra (that means “Overtime”, our weekly social meeting) at Lapa 40º. The entrance was free to everybody that had the Dev in Rio 2009 badge and that was how we realized the biggest and best #Horaextra ever:


* Watch more Dev in Rio 2009 videos.

I’m sure that this simple blog post cannot tell even 0,001% of what Dev in Rio 2009 was and how happy I am for being able to make it. I’d like to thank again the fundamental support from the folks of Globo.com that was the main responsible for making it happen, our sponsors Caelum, Locaweb and D-Click and everybody else that have supported us some way: Associação PythonBrasil, Fábrica Livre, Myfreecomm, OpenSourceMatters, Arteccom, DojoRio, Dojo@SP, #Horaextra, PythOnRio, RioJUG, RubyInside Brasil, Guanabara.info and everybody that attended to Dev in Rio 2009. Without your support nothing would’ve been possible!

Dev in Rio 2009 - Everybody in the end
* Participants of Dev in Rio’s round table.

If you didn’t go to Dev in Rio, I have two things to tell you: (1) you did lose one of the best conferences in Rio ever but (2) we’re going to make the presentation videos available very soon to alleviate your pain. :)

See you in 2010!

Why I don’t write code comments

Sunday, April 5th, 2009

These days I was configuring some personal projects on ohloh and one thing called my attention. Ohloh showed the message “very few source code comments” in all my projects.

This is no surprise to me. I really don’t like to write source code comments. Why? Because if my code isn’t clear and easy enough for one to read and easily understand, I need to refactor. Many times I ask friends to take a look at code snippets and check if they understand. When they don’t, the method is usually too big or the variable/method names are not clear enough, and then I refactor to make it better to understand.

One example that I love (and use in many presentations) is the code to send e-mails using Java Mail API. The code would be something like this (from Java World tutorial):

// create some properties and get the default Session
Properties props = new Properties();
props.put("mail.smtp.host", _smtpHost);
Session session = Session.getDefaultInstance(props, null);
 
// create a message
Address replyToList[] = { new InternetAddress(replyTo) };
Message newMessage = new MimeMessage(session);
if (_fromName != null)
    newMessage.setFrom(new InternetAddress(from,
        _fromName + " on behalf of " + replyTo));
else
    newMessage.setFrom(new InternetAddress(from));
    newMessage.setReplyTo(replyToList);
    newMessage.setRecipients(Message.RecipientType.BCC, 
            _toList);
    newMessage.setSubject(subject);
    newMessage.setSentDate(sentDate);
 
// send newMessage
Transport transport = session.getTransport(SMTP_MAIL);
transport.connect(_smtpHost, _user, _password);
transport.sendMessage(newMessage, _toList);

I know that this is just an example but you know that it’s not difficult to find monsters like this one in production code.

This code is so difficult to read that the programmer had to say what he was doing, otherwise nobody would understand its purpose. There is a lot of infrastructure and business code together resulting on a huge abstraction leak.

Now take a look at the following code (from Fluent Mail API) and tell me how many seconds do you need to understand what the code does:

new EmailMessage()
    .from("demo@guilhermechapiewski.com")
    .to("destination@address.com")
    .withSubject("Fluent Mail API")
    .withBody("Demo message")
    .send();

This is an extreme example, of course. Maybe you will not write Fluent Interfaces for every little thing you need in your code, but if you add just a little bit of organization (using a better abstraction) it will already improve code readability:

class Email {
    public Email(String from, String to, ...) { ... }
    public void setFrom(String from) { ... }
    public void setTo(String to) { ... }
    public void send() {
        // put your complicated Java Mail code here
    }
}

Just by encapsulating the code in an abstraction that makes sense the WTF effect will be sensibly reduced. The programmers can now at least assume that the code sends e-mail messages since it’s included in a class called “Email”.

And that’s the point. When I create a culture of prohibiting myself from writing code comments, I’m obligating me to write easy, maintainable and understandable code.

That’s very extreme, I know, but the results of this approach are awesome.