tucaz.blog.now() Rotating Header Image

(Portuguese) Eu não uso Scrum porque Scrum não funciona!

Sorry, this entry is only available in Portuguese.

(Portuguese) Verbos HTTP: GET e POST. Você sabe mesmo a diferença?

Sorry, this entry is only available in Portuguese.

Back to Brazil

I guess everybody already knows, but for those who don’t: I’m back to Brazil. The initial idea was to move to USA for good, but unfortunately some family matters came to show up here and I had to come back. The idea still lives and it’s gonna happen, but not so soon now. I’m still working for HNI, remotely though. However, It’s still a great and new experience due to timezone differences and communications problems. A lot of opportunities to learn from.

Because of that, I think I won’t be able to write long posts as I use to do before. Posts like that, mainly related to people and management ideas, are hard to write and take a lot of time. In this case I’m going to write smaller posts with personal opinion regarding the subjects I like and share useful information about mixed subjects without deeper thoughts. At least for now.

Another thing I wanted to say is that I’m working on some blog tweaks and you already going to see a new one: multiple language plugin. Based on the HTTP request the plugin is going to identify which language should be shown to the user: English or Portuguese. I did that because I still want to write in English to reach more people and to practice the language, but there are some content that are only relevant for Brazilian people who on the majority only understands Portuguese and I want to reach these people too.

All posts are still available to both languages but you will need to click on those that are not you’re native language in order to ream them. The home URL of the blog is going to make the distinction between the languages but if you want to choose yourself you can access http://blog.tucaz.net/en for English content and http://blog.tucaz.net/br for Portuguese.

So, to end this post, I want to ask you to report any errors or problems with the blog itself or with the feed (I still don’t know how it’s going to behave with this new plugin) and say that any questions, suggestions and complaints are more than welcome. Feel free to contact me anytime :)

[Book Review] Startup

Front cover of Startup

Front cover of Startup

It’s been a while since my last post. I was in USA at the time. Now I’m Brazil again. A lot of things have changed, but I will (hopefully) write about it on another entry.

Right now I want to write about a book that was on my reading queue for a while: Startup by Jessica Livingston. I got this book last weekend and, truth to be told, I am a little bit frustrated with it.

Before I bought it I expected to see great insights about starting a new company, making it develop and grow. But this wasn’t what I got. The book follows the format of a series of interviews made with founders and co-founders of big and important companies of our time where they explain a little bit about how they started, but without any deep thoughts. Companies like Apple, Hotmail, Yahoo!, Firefox and other.

So, after some moments of frustration I changed my mindset and could actually enjoy the reading. I stopped thinking about getting good insights from it and started to read it to understand how American startups worked, subject that I had a vague idea about. Now I have a little bit more information about it and it goes like this:

Most American startup companies are created in college/university. Great and brilliant students get together and talk about a really nice idea. You can almost think that they can predict the future because they changed the way we use computers today, but they don’t. They actually make the future happen the way they wanted. Almost always, after discussing and prototyping a bit they come up with a business plan and with this very important piece of paper in hands they go after investors. Venture capital investors. People who want to risk their money in things that might work in exchange of a piece of the company. Making a long story short, after a lot of work and effort they sell (or not) their companies for billions, pay back the investors and sometimes keep working for the company as an ordinary employee.

Getting back to the book and startups formation, the first thing you will notice is the fact that opening a startup company has nothing to do with Brazilian reality. It won’t work here the same way it does in USA. Not even close. It’s all about culture and infrastructure.

In USA you can find good universities (they are expensive, but also good) that teaches you a lot of new things and the basics about everything you need to know to work with computers (or whatever subject that you are studying). But we also have good universities, right? Yes we do, but the problem is that only a minor portion of our students have their studies paid by their parents, like they do. In Brazil we have to work our way through college/university and think about bringing money to our home and families. We have to worry about making a living. In my opinion this is the big difference: investment in education. We could use some of that here.

While in college, American students don’t have to worry about anything else other than studying. The structure offered by the government and their families makes students prosper. They have the knowledge in their hands, the supplies and tools needed to transform the knowledge into something tangible and in the end a culture of investment that makes it possible to raise large amounts of money needed to start a company and keep it breathing. We have all this guts too, but unfortunately we don’t have the culture and the investments necessary to make it work.

Of course we cannot take away all the quality and merit that they deserve. They have great ideas and guide our IT world. But, I would say that this only happens because they have a more fertile environment (government quality, economics, security, etc) than we do.

It doesn’t mean that we can’t do something like that. It only means that is harder here. Thanks to our interest rates, taxes and politics. We can see that this is true by counting the number of startups in Brazil and how many companies survives after five years that they are open. I don’t think I can fill my hand’s fingers couting it. Can you?

Although it’s not a must read book I would say that is a good reading that can help you understand a little bit more about the foundations of the companies that currently rule our world when it comes to IT.

Hope you enjoy!

ps: Even though I was in USA for three months and studied a lot of English it still needs improvement and because of that you will find some errors in the text. If you want to help, please leave a comment when you find one. Thanks! :)

Basic stuff: handling exceptions in .NET

Last week we had a severe problem with exception handling in a project I’m working in. All the exceptions were being suppressed so we couldn’t know what was going on when some functionality didn’t work as we expected it to. This happened because a member of our team misinterpreted exception handling and put try/catch blocks in every method that he coded, but didn’t put any code in the catch block.

The  code spreaded everywhere looked like this:

try
{
     //Aplication logic goes here
}
catch (Exception ex)
{
     string error = ex.Message;
     //No re-throw or any exception handling code. Just this.
}

As soon as we discovered the problem (and who was causing it), Max (a co-worker) wrote this “guide” and we made sure that everybody involved in the project read it. This is pretty basic stuff, but lot’s of people still don’t understand it. I’ll reproduce it below “as is” hoping that it will help you or someone you know :)

What is the problem? Whenever an expection is trown, the code is trapping it in the catch block and it’s basically destroying it without proper handling and without escalete it in the stack (exception bubbling).

Why is it a problem? This results in one of the worst maintenance nightmares. As the exception is being destroyed before it can be captured, bugs will become almost impossible to track in an QA/Production environment where debug is not available. Even in the development environment, chances are you’re only going to be able to track the root cause stepping through the code line by line.

What to do? Unless you really have a need to do something specific with an exception, just let it escalete through the stack. Exceptions are usually handled at a higher level (like the user interface). Even when you need to do something with the exception, it will usally be necessary to re-throw it at the end of your code uless you’re coding the last layer (like a UI).

Here are some good practice examples:

Example 1:

public string GetUser(string userName)
{
    return new DAL().GetUser(userName);
}

In this example the GetUser represents a intemediate layer code. As we don’t need any special handling, any exceptions resulting from the DAL method call will be simply escalted to the caller through the exception bubbling.

Example 2:

public string GetUser(string userName)
{
    try
    {
        return new DAL().GetUser(userName);
    }
    catch (Exception ex)
    {
        LogHelper.LogException(ex);
        throw;
    }
}

In this case we do need to do something special about the exception. A good example would be a web service, where we should be loggin any errors, but re-throwing it to the caller so the application will be aware of it.

Example 3:

bool isValid = false;
try
{
    //Your application logic goes here
    isValid = true;
}
catch (DivideByZeroException)
{
    //Nothing needs to be done in case of an exception, this will kee the flag isValid as false
}

This example illustrates a situation where you really need to destroy the exception. The Try/Catch block is being used exclusively to set a flag that depends on the result of an operation that might throw an exception, which would mean the status is invalid. Please note three important things:

a) In this case it is fundamental to add a comment to the Catch block in order to let your intention clear.

b) As you’re not planning to do anything special with the exception, a “catch(DivideByZeroException)” syntax is enough, since you won’t need to assign the exception to a local variable (which would generate a compilation warning about an unused variable). e.g.: catch (DivideByZeroException ex).

c) In this type of scenario you’re looking for a specific exception, so make sure you’re catching only that specific type of exception and let anything else bubble up (meaning, do not use “catch { }”). Also, when catching a specific exception, there’s no need for adding extra catch for the generic exception, anything else will automatically bubble up:

catch (DivideByZeroException)
{
    //Nothing needs to be done in case of an exception, this will kee the flag isValid as false
}
catch //There’s no need for this block
{
    throw;
}

Issue: You re-throw the exception using the “throw Exception” syntax:

What is the problem? This resets the exception stack trace.

Why is it a problem? The stack trace is lost and higher levels will perceive the error as being generated by your code. The main issue is the fact that it won’t allow you to track the root cause of the exception.

What to do? The correct syntax to re-throw an exception is to simple state “throw” in your code, this way the stack trace is preserved.

try
{
    //Application logic goes here
}
catch (Exception ex)
{
    LogHelper.LogException(ex);
    throw;
}

What if you need to generate a custom exception? Same issue with the stack trace. In this case the Exception constructor provides a parameter for the inner exception that must be used:

try
{
    //Application logic goes here
}
catch (Exception ex)
{
    LogHelper.LogException(ex);
    throw new Exception("My custom message", ex);
}

Issue: Unnecessary use of a Catch block when all you need is to get some code running at the Finally block:

try
{
	//Application logic goes here
}
catch
{
	throw;
}
finally
{
	//Your finally code goes here
}

What is the problem? The catch block in this case is completely unecessary.

Why is it a problem? Not a big deal, but it represents unecessary lines of code that will make your code look dumb to your collegues.

What to do? Just use a Try/Finally block:

try
{
	//Your application logic goes here
}
finally
{
	//Your finally code goes here
}

ps: methods used in the examples are using an anemic model for simplicity purposes.

Leading by omission

Yesterday I was watching a great screencast made by Akita On Rails about agile software development and the future of software organizations and at some point he mentioned a speech named “Leading by Omission” that Ricardo Semler, CEO of Semco, gave some time ago at MIT about nonexistence of hierarchical chain of command at Semco and how it works for them. With that kind of management system Ricardo was able to drag Semco out the down path twenty five years ago and turned his company into one of the most successful companies in their field.

During the screencast, Akita also mentioned that, at Semco, the employees are responsible for defining their own salaries and they can choose who their boss is. This different way of working attracted my attention and made me search for Ricardo’s speech.

I found it at MIT World website which also holds many other videos about almost all subjects you can think of, from science to religion. I only watched Ricardo’s speech, but definitely other videos are on my queue now :)

The video is almost fifty minutes long and worth’s every second of it. You can find it here or watch it below.

Communicating and understanding are the keys to succeed

Is that what you really want?

Is that what you really want?

This is a very simple thought once you figure it out, but it appears that most team leaders and managers didn’t figure it out yet. So, I’ll write explicitly and hope that some of these people out there will read it here. :)

In order to achieve a goal through team work[1], the manager, or whoever is responsible for that, has to make his team understand three things: what exactly they are supposed to do, why they have to do it and what is the unacceptable result or, in other words, what they can’t do.

It’s really simple, but I only realized that this is an universal truth one year ago when my first agile attempt failed. After that, I spent a lot of time thinking why it went out that way. My first thought was that my team really sucked and because of that they were unable to do what I expected them to do. But after some time I realized that my team was very good technically and that the problem was my failure to properly communicate with them. I was unable to communicate them these three simple pieces of information.

Since that, every time I need to lead people, I try my best to make sure that they really understand what’s going on. Because if they don’t, the best result I can expect is that they’ll follow my instructions as a monkey will do and, hopefully, I’ll get the job done. I don’t want that. I don’t want to hope for something. I want to be sure that, at least,  I’ll have the best that these people can offer and don’t have to review their stuff all the time to make sure they got it right.

In this whole last year, I gathered some thoughts from my experiences on how to communicate these simple pieces of information and here is what I came with:

  • Explain how it’s going down, present the contextBefore any movement, present the general idea of the project[2] to everyone that’s involved in it. Don’t simply tell them which tasks they are supposed to execute. Understanding the context (technical, business and political) is very important.
  • Make sure they understood – Ask some questions, have them presenting some ideas and thoughts about the project. If they really understood it, they’ll look excited (unless the project sucks!) and you will quickly notice they got it. This feeling of understanding will be presented to you as shinning eyes. That thing we all have when it rings a bell inside our head.
  • Tell them how/why it works – Talking specifically about software now, if we need someone to solve a problem by coding something we can’t just tell them how a screen or a procedure should work and expect success. To achieve it we need to fully explain why that thing should be made in this or that way. By explaining how things work we get two main benefits: 1) The act of explaining is the best way to make sure we understand about the subject ourselves and 2) We can use other’s knowledge and experience to make it work even better.
  • Show you trust them, share responsability and authorityAkita described it very well (it’s in portuguese, sorry) in his blog post. It’s vital that who is going to execute something has the authority to fulfill the responsibility he just received.  You should trust and believe that the responsible person is going to execute it in the best way he can and give him all freedom he needs to do his job.
  • Make a plan – Planning is a very important thing. Not because of the final plan, but because of the act of planning itself. When you plan you have to think about the subject. You have to think how it can be done, what are the risks, what more should I know that I don’t know, etc. Do it together, with all team members.
  • Also, give limit boundaries – Last tip, it’s important to define some boundaries to everyone that is involved, borders that they can’t cross. If for any reason they can’t do something or you don’t want them to do something you have to explicitly tell them no to do so. Otherwise there’s no way they’ll know it. And of course, you have to explain why they can’t or shouldn’t do it.

I believe that these five tips can increase the success chances in almost all scenarios we face everyday dealing with teamwork and I also hope that it will help you the next time you ask for something and get it different than you imagined.

[1] It doesn´t have to be a big team. I consider team work when more than one person is engaged in the same project to achieve the same goals.
[2] I’m using the same definition for project that David Allen does. Project is anything that needs at least two steps to be done.

Almost good!

Hey!

It’s been a while since I wrote my last post. That’s because I was a little bored of writing. But now, I think I’m good to start it again. Did you miss me? :)

When I moved this blog from the old server I had some troubles during the change and I was too lazy to fix them, until today. I took a deep breath and made a fresh install of Wordpress. I still have to install some missing plugins, but I’m pretty confident that everything is going to work normally again.

I also changed the blog template (but I guess that you can see that, right?) and during the next few days I’ll still be adjusting it to look better ( I don’t know if it’s possible for it to look good, but I liked it anyway).

So, from now on you can start waiting for regular updates again on this blog :) .

By the way, I gave up on my Flickr because it really sucks. So if you want to see my pictures you can go to my Picasa Web. I hope you enjoy! :)

Blog Maintenance

Today i’ll be moving my blog from the current host. During this time it may be inaccessible due to DNS changes and it should take some time until new DNS are replicated. Sorry for the inconvenience.

See you soon!

We should fire more

Before I get to the point in this post I should say that this is my first post in English and because of that I’m sure that it’s going to have a lot of mistakes. Knowing that, I would like to ask you to correct me whenever you find one of them. Ok? Let’s go!

I’ve been working as a professional developer since 2004. At that time I didn’t really know anything about software development. Nowadays, almost six years later I still don’t know much, but one thing I do know: only people can make a project succeed.

Since I started working I talked to many people from many different companies (clients and co-workers) and for a little bit more than two years i am in a position where i can choose if we should hire someone or fire someone. During this time I’ve heard almost nothing about people getting fired for being a bad professional. That’s a strange behavior and made me think. Why don’t I see many people being fire? I think I can count on my fingers how many times I saw someone getting kicked out from a company. If we pick my team as example I can tell you that we worked approximately with thirty different people in these years and I can only remember of letting one person go.

After gathering this personal experience, watching a lot of presentations and reading books and articles I realized that projects and products that were successful had one simple[1] thing in common: good people.

I think that the modern companies that are full of those “quality guaranteed” processes (ISO, CMM, ITIL and [put another silver bullet process in here]) forget how to make people perform good on their jobs. They put too much effort in the belief that the process is enough to keep things great and forget that people doing mediocre work are very bad for business.

By doing nothing to this people, we are encouraging who doesn’t do a good job instead of congratulate who really does. If I stop and look backwards I’ll see that i did that myself a lot of times. I saw someone on the team that was not up to his/her tasks and even seeing that I kept myself quiet. This is very harmful for everyone involved.

Another reason of why it happens is laziness. Managers and leaders often see that a team member is not corresponding well but they are too lazy and accommodated to do something about it. It’s easier to let things just happen than change the situation and hire someone more skilled[2] to do the job.

I could seat here and write until sun shines again how a bad professional looks like, but I’m pretty sure you know how to recognize one. Everybody knows what a bad professional looks like, but still, they have jobs and they make my job (and yours, good one) more difficult.

So from now on, promise yourself that you’re not just going to keep the wheels spinning. Propose changes, challenge people, force them to do their best. If after all this hard work you still have a bad team member, fire him/her and give his/her place to someone who deserves it. This is the only way we can build better teams and make bad professionals go away (or improve themselves).

[1] Yeah, it’s pretty simple once you’ve figured that out.
[2]
By skilled I meant technical and personal skills that are very necessary to make a person able to be part of a team.