views:

791

answers:

19

Am I a lazy developer? Is it being lazy to use automated tools, such as code generators and such?

Now, I could, if I had to, create all the data layers and entities I needed, but I choose to use CodeSmith to generate my datalayers and entities. I also use Resharper and I would say it fights with MSDeploy as to which gets installed first after Visual Studio. Again if I had to, I could code without it, but prefer not to.

Both these tools from my point of view are no brainers as they improve output massively.

But is this lazy? I'm sure there are purists out there that would say everything should be wirtten by you so you know what everything is doing, but if you can read through the code and see what is happening is that ok?

So am I being lazy or am I just using all the cards in my hand?

+1  A: 

You're using all the cards in your hand. Why reinvent the wheel when there are tools available to make your job easier. Bear in mind these tools DON'T do your job, they only assist.

What you create is down to you, so using the tools is not lazy... it's just intelligent.

GenericTypeTea
But at the same time don't forget there are different tools for the same job. (I have seen people take 10 minutes to set up a power saw for what would of taken 2 minutes to do with the hack saw sitting on the bench.)
Matthew Whited
+5  A: 

You don'nt need to reinvent the wheel n times, this is done often enough. Briefly I'd state that using tools like the ones you mentioned (within reason) is absolutely no problem...

KB22
+1  A: 

I'd say you're more efficient rather than lazy.

mxp
Laziness is what you get when you use code generators to be efficient, but use the time saved to screw around StackOverflow instead of devoting more time to some other aspect of the project you're hired to do. Another explanation of laziness: laziness is when you use a code generator, but it doesn't quite do what you want so everyone else is forced to hack around it (i.e. when you use something that's not the right tool for the job to avoid doing it right.)
Ken Bloom
+9  A: 

It's only lazy if you use a tool to produce code and use it as-is without verifying that the code meets your needs and abides by your standards.

Mayo
+18  A: 

In programmers, laziness is a virtue, so don't worry.

innaM
At least, that's how was justify it so we can feel better about ourselves ;)
Mark
+2  A: 

Both these tools from my point of view are no brainers as they improve output massively.

This means you're not being lazy, you are using the appropriate tools to enable you to concentrate on the important aspects of the job.

ChrisF
A: 

It's not being lazy - it's being smart. There's nothing wrong with using every tool at your disposal...as long as it makes you more productive. Using tools for the sake of using tools is a bad idea.

However, if you don't know what your tool is doing under the hood, you should learn about it so if you don't have the tool available for some reason, you can get the job done.

Thomas Owens
+3  A: 

For you? No, you're not being lazy.

For the guy that doesn't understand what code generators are doing and how they do it? Yes, it's being lazy.

That's the important distinction: You have to know what you gain and know what you're missing by using a code generator. If you don't, it's only a matter of time before you come across a case where you have to be able to produce those classes and not know how.

George Stocker
Does that would mean that someone that doesn't know how a compiler works is being lazy by using one?
Matthew Whited
@Matthew Whited I realize you're being glib; but you ought to realize that there are those that blindly use tools without knowing why or how they work, and they become a detriment to their team.
George Stocker
There are programmers that don't know how compilers work? Buy a book, guys. Sheesh.
David Lively
A: 

I'm sure there are purists out there that would say everything should be wirtten by you so you know what everything is doing

This might have been a viable point of view during the early days of programming. But nowadays, this is simply not feasible (or even preferable). After all, you've already obscured a certain level of understanding just by using a high-level language.

That said, I've found it to be a great learning exercise to write some of these things by hand occasionally. Not only do you get to learn more, but they teach you how helpful these tools really are (or aren't). Note that I'd only do this on a personal project though. I wouldn't do this for any project someone was paying me for (unless I were working for a masochist or something).

Jason Baker
A: 

Ask yourself why there are so many ORM and other code-generation tools around. I'd say go for it with the proviso that you leave it maintainable for the next guy/gal.

Alan B
A: 

Programming is about being lazy, about automating repetitive tasks. If you can't do that inside your language, using code generators and similar things is a useful workaround.

Svante
+2  A: 

I think that's the wrong question. Laziness is a virtue. I've seen too many programmers who do things the hard way rather than sitting back and thinking for a few minutes to come up with an easier way. I've had so many times that I've said to a junior programmer something to the effect of, "Yes, I respect your diligence in working through lunch and staying late to write the code to do X, but if you'd taken a few minutes to check the documentation you might have seen that there is already a function in the library that does that". Or similar stories.

I'm not familiar with the specific tools you describe, but to me, the question always is, Does this tool actually save me any work? I've tried plenty of "code generators" that basically just create code stubs. So gee, thanks, you wrote the "function x(int, float)", now all I have to to is fill in the actual parameter names and write the code. What did that save me? I've also seen plenty of code generators that write really awful code. So now I have to try to add the "custom" code to this jumbled mess. Wouldn't it have been easier to just write the whole thing cleanly the first time? I've seen plenty of productivity tools where I found it takes me more time to set up the parameters to run the tool than I actually saved by using it. (Like the old joke that it's been proven that jogging regularly really does make you live longer: for every 60 minutes you spend jogging, it adds 30 minutes to your life.) Some tools may produce code or data structures or whatever that is difficult to maintain, so you save an hour today but it costs you ten hours in maintenance over the life of the project. Etc.

My conclusion isn't that you shouldn't use productivity tools, but rather that you should make sure they really are increasing your productivity, and not just giving an illusion of doing so. If in your case you find these tools really do help you, then using them is not "cheating", it's simply smart.

Jay
Very well written response!
David Lively
A: 

It depends on what you're writing, of course. I am suprised nobody's brought this up. If you're writing device drivers, operating systems, protocols, or server software (web servers, tcp driven servers, etc), you should probably do it by hand.

But with what I do and probably what a lot of us do is implement business processes in code for web pages or web services. And in those areas, if you can improve on your code with code generators, go for it.

quillbreaker
A: 

Yes you are being a lazy developer, be honest to yourself, if you take the time to do it the hard way you can call yourself less lazy than you are now.

The point is, being lazy isn't inefficient at all. Lazy people take time to look at the problems from different direction before acting upon it, this avoids unnecessary errors which saves you valuable time.

So you're being lazy, but that's ok. People don't hire hyperactive coders that make 10 applications each day but leave a trail of bugs on their path. bug-fixing costs time, time is money.

conclusion: Laziness = profit

Go for it.

Pieter888
A: 

I think the best developers are also the laziest. Basically, all you're doing should be focused on getting the end result with the least amount of work. This often provides the best result and also avoids developers from being distracted by fun things to include in a project. A lazy developer would e.g. never add an easter egg to his code, simply because this would be more code, which could introduce more bugs that need to be fixed later on. Adding code is bad, since you'd also add more bugs that you need to resolve later. Still, you will need to add code, else you won't get paid. So, as a lazy developer you would of course choose for the most optimized code, the best-tested code which would almost never fail and you'd work in a way that the chance of errors is reduced to a minimum.

Do keep in mind that lazy developers should focus on avoiding work in the future, not on avoiding work right now! So stop reading here and get back to work! ;-)

Workshop Alex
A: 

As everyone else already pointed out there's nothing wrong in your use of code generators.

Still I can see downsides and reasons to avoid it in certain particular sitations.

  • choice of language. Sometimes the very same fact you need a code generator to get your coding started could imply you're using the wrong language for the task. Most times language cannot really be chosen, so code generators remain the best way to go.

  • code redundancy. Depending on the actual generators used, generated code could be redundant, if this happens and generation happens once, isn't automated, and generated code goes into the main repository maintenance problems could arise in the long run. Not really a problem with code generation itself, but with the way it should and should not be used.

  • adding development platforms requirements. We have to concede many programmmers out there work on bread-toasters doubling as PCs. It's really a bad, (and sad) reality of cheap business practices meeting sharp minds. (sharp minds go to waste in the process) It could become a concern if our project (which could have a port in store for the future, and in an external facility either) needs an hefty, ram hogging, not enough cross platform, IDE handy to compile every little modification.

So, no definitive answer on code generating lazyness and programmming: it depends. Then again, using the wrong tools for the job is bad for your health, (and business) so... don't.

ZJR
+1  A: 

Programming is primarily a thinking exercise not a typing one. So long as you understand what the tools are doing you're shifting the balance away from typing to thinking. Doing more of what your job is about? Doesn't sound like lazy to me!

FinnNk
A: 

Think on this also-Is using high level language over assembly language laziness ??

Malay Kachhadiya
Well I always refer to my .net code as pretend coding, lol
JamesStuddart
A: 

Laziness is a trait that most good programmers have. Unless they work for Adobe, in which case they are often lazy in a bad way.