venta viagra españa comprar viagra españa cialis prix belgique cialis pas cher paris viagra generique piege kamagra generico cialis naturale alle erbe cialis versand aus deutschland kamagra ajanta qu est ce que soft viagra alternative cialis köp viagra online prix du cialis avec ordonnance super kamagra generika comprar levitra contra reembolso forum cialis generico
viagra online versand viagra indien viagra senza ricetta in italia dapoxetin kaufen comprar viagra seguro viagra a acheter cialis receta medica tadalafil generico farmacia achat clomid acheter générique cialis viagra generique 48 h chrono cialis generique indien cialis 5mg rezeptfrei proscar kaufen levitra online bestellen

Don’t Repeat Yourself (Unless Reading Book)

The Pragmatic Programmer

After reading Pragmatic Programmer at my recent vacation, I immediately found an urge to repeat myself and read it again.

Ironic that one of the most popular tips from it is “Don’t repeat yourself”. Even though the book was published in 1999 (before the agile manifesto), there are so many golden nuggets in the book, that I find myself constantly using it at work.

Many of the principles are well-known today — the DRY principle is constantly used when developing Ruby/Rails applications and is a good pointer to the ability to change code.

Many of the pragmatic tips are ubuquitous in Ruby on Rails and well known because of the popularity of agile principles. Still the book is good, relevant and everyday useful. And most of the tips from the book can be applied for motivation in the projects I work on.

Bonus link: Jeff Atwoods article about the Department of Redundancy Department:

I have an awfully hard time defending the unnecessarily verbose way objects were typically declared in C# and Java.

BufferedReader br = new BufferedReader (new FileReader(name));

Who came up with this stuff?

Is there really any doubt what type of the variable br is? Does it help anyone, ever, to require another

BufferedReader

on the front of that line? This has bothered me for years, but it was an itch I just couldn’t scratch. Until now.

department of redundancy department.

 

Technorati Tags: , , , , , , ,

5 Responses to “Don’t Repeat Yourself (Unless Reading Book)”

  1. ilyas Says:

    Yeah you said it right don`t repeat yourself or in other words Golden words should not be repeated.

  2. Kaj Says:

    IMyInterface x = new ImplementationClass();

    Thats why it is repeated!!!!

    But you could have a point that the languge should have a way to just say
    IMyClass = new ()
    if its just an instance of the same cla

  3. petering_sob Says:

    C# actually introduced the “var” keyword in 3.0

    var br = new BufferedReader(…);

    implies that br is a BufferedReader

    To elaborate on Kajs reply:
    when using inheritance, any superclass (including interface definitions) are valid members of the type of the subclass. Therefore it is necessary to be able to define the type of the object. This needs not be the case with ducktyped languages, which I suspect that ruby is (without bothering to read the spec)

  4. JayEB Says:

    I love to read a book or even an article that has plenty of “handles” that I can take away. On your recommendation, i think I will have to run out and get this. There are some of these kinds of things that I have taken with me for my entire life.

  5. James Says:

    I wish I’d known about the don’t repeat yourself guideline before I started writing the ruby application I’m working on now. It really does pay to take a little more time to do something just once. Going back over code and changing things on 50 scripts can be a nightmare.