Wednesday, September 17, 2014

A Good Developer is a Lazy Developer

A Good Developer is a Lazy Developer


What!?!? You're kidding, right?

Sometimes I work long hours. Late nights, early mornings. I even keep a notepad handy in case I get an idea in the middle of the night. I've solved many problems at 3am. So why would I make such a ludicris statement as "A good developer is a lazy developer"?

Because it's true.

Over the years I have seen dozens of frameworks, processes, architectures, patterns, etc. all designed to make my life easier. Why would so much work go into making my life easier? Because we are all sick and tired of rewriting the same sort or filter or query over and over again.

Software development has gone on long enough that, except in very special cases, what we're writing has already been written. What we're trying to do has already been done. And what we stay up late at night trying to figure out is only a web-search away, if only we could figure out the right search to get us to it.

Imagine trying to sort a list. All of us programmers have done it. We had to sort a list to pass that horrible CS class, didn't we? We don't ever have to do that again. Every way you can imagine sorting a list is already out there. If you use ASP.Net you can sort any list with one line of code and a delegate method (see a future post on this blog for more on delegates). The delegate method itself is almost always going to consist of one line as well; a simple compare statement. If you write more than that, you are not lazy enough.

How about dates. Oh...I used to hate dealing with formatting dates. Everyone wants their dates displayed differently. And don't get me started with localizing dates. US dates have the month first, everyone else puts the day first. What a mess! Not really. In ASP.Net it is easy. Using a combination of the String.Format methods and the System.Globalization namespace you can get your dates into the format you want with little extra effort. This namespace will also get those commas and periods in your numbers formatted for the right locale with no sweat at all.

Get Lazy!

Learn the API's.

Use the libraries.

References

System.Globalization
String.Format

No comments:

Post a Comment