Black and White Thoughts

About

Name: Rafael George
Log: About anything interesting on the internet or inside my brain.
Contact: george.rafael [at] gmail [dot] com
Designed by Josh. Powered by Tumblr.

» How To: Get Hired on eLance

Probably i’ll begin to try this tips soon



November 18, 2009, 3:33pm  Comments

» Tweet your builds with Maven Twitter Plugin



November 16, 2009, 12:38pm  Comments

[ Craftsmanship ] Refactoring Technique: Chain Constructor

This is one of many more techniques that i will try to share every time i find a new one, stay tune for more. But first we all should know what is code refactoring.

Code Refactoring is the process of changing a computer program’s internal structure without modifying its external functional behavior or existing functionality, in order to improve internal quality attributes of the software. Reasons include to improve code readability, to simplify code structure, to change code to adhere to a given programming paradigm, to improve maintainability, to improve performance, or to improve extensibility.

The first technique i will show is called Chain Constructor. It’s consists in the elimination of duplication in constructors in a class through chain calls to one constructor in the class.

When constructors in a class implement duplicate work, the code fails to communicate what is specific from what is general. This mean is easier for us to communicate intention. Duplicate code in your constructors makes your classes more error-prone and harder to maintain. If more than one constructor contains the same code, is harder to see how each constructor is different, simplify your constructors by chaining calls to one general purpose constructor.

Here are the steps to do a chain constructor refactor in your code:

  • Find two constructors that contain duplicate code. Determine if one of the constructor can call the other one, so that the duplicate code in one constructor can be easily erase from one of the two constructors.
  • Compile (And i hope you have test) and test.
  • Repeat the first and second step for all constructors in the class, including the one you already touched in order to remove all possible duplication.
  • Change visibility of all constructor that may not be public.
  • Compile and test.

And that’s all, happy refactoring.



November 11, 2009, 10:01am   Comments

[ Rant ] IT wisdom from a corporation

Today i receive an email from the internal mailing list of the company that i work for one of the biggest telecommunication corporation around the world.

It’s says that the applications and servers are the lifeblood of the company’s business, if that so why most of our software is so bloated and poorly designed?

I know that this is so, because there is not structure for self improvement inside and a lot of employees just wait for the companies to instruct them. That’s really a shame, but is the true for most people working in IT this days.

So, please God of the IT mailing list, “which i know is another poorly written script”, stop sending us this type of hipocracy in an email form.



October 26, 2009, 8:17am   Comments

“Life is not about waiting for the storms to pass…it’s about learning how to dance in the rain.”

— Anonymous



October 14, 2009, 8:04pm  Comments