Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Micro Code Generation Considered Harmful?

I recently wrote a small tool to generate a class for each tier I hand write for the boring "forms over data" work where I spend almost 90% of my time (depressing I know) ... more on this as the economy improves ;)

My question is this - will using this tool instead of hand typing all this code from day to day actually hurt me as a developer? I feel like I will always be making changes to this tool and thus I "should" stay on top of the patterns used/ choices made/ etc... but some small part of me feels like I might lose my edge ... am I wrong?

like image 1000
Toran Billups Avatar asked Jan 08 '09 17:01

Toran Billups


2 Answers

If the tool can spit the code out without thought, then it probably saves you lots of thoughtless typing.

Writing the tool in the first place requires thinking, so I'd guess you'd be more "on the edge" maintaining and writing the tool.

like image 92
Gilad Naor Avatar answered Oct 01 '22 05:10

Gilad Naor


That's good! Of course writing a tool to do all the job for you is impossible and wrong.

But automating repeatable tasks is always good - and sometimes writing specific types of code is repeatable.

It is even encouraged in the "Pragmatic Programmer" book.

Make sure that in the source control you have checked in a code generator and not its output (unless you have to modify the code later by hand)!

like image 32
Paweł Hajdan Avatar answered Oct 01 '22 06:10

Paweł Hajdan