Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The nice thing about Code Generation is that you can do it as often as you like. So if you change something, you just re-generate all the boilerplate and you're back in business.

This is the one instance where I'll argue in favor of duplicated code. When something breaks in one of your generated classes, you'll find yourself on a breakpoint at a single line that does a single thing, so you can quickly figure out what happened and why (and what changes you'll need to make to the Codesmith template so that it never happens again). When your "right abstraction" breaks, you might find yourself seven interfaces deep looking at a hash full of Objects, one of which is probably not supposed to be null, maybe, and it's not going to be any fun to debug.



I'm inclined to suggest that the right abstraction be implemented well so it's not so hard to debug.

Proper macros provide a nice way to blend the advantages of each. There are even some new languages that have them without looking like Lisp (Plot and Ioke come to mind).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: