T22: Generate the Repetitive, Boring Code: How to Write Code Generators
Monday, Oct 23, from 08:30 to 12:00, C125
Do you feel like you are repeating yourself? Are you writing a lot of code that seems very similar to the code you wrote yesterday, yet it differs enough to not being able to hide it within a framework? Then the solution for you may be to generate that repetitive, boring code. In this tutorial you will get an insight into what code generation can do for you and how it can increase your productivity and the productivity of your team. You will learn how and when to write your own code generators and that writing a code generator does not have to be a massive amount of work. You will also see examples of code generation tools and frameworks that can help you write your own code generators easily. Most of the code examples will be in Java and C#, but we will also show examples of how a dynamic language like Ruby can be used in the code generation field. No prior knowledge of Ruby is expected though.
Intermediate: Basic knowledge of some mainstream object-oriented language is needed. Code examples will be in primarily be in straightforward Java and C#.
Goals: The attendees will learn when and how to write code generators. They will learn about existing tools and frameworks that can be used when writing code generators.
Format: This tutorial will be lecture based with live examples of working code generators. The presentation will also show the presenters writing small code generators to help demonstrate the power of code generators.
Niclas Nilsson, Activa: Niclas is a software developer consultant, educator and writer with a deep passion for the software development craft. He started working as a developer in 1992 and drawn from experience, he knows that some choices makes significant difference in software development, like languages, tools and processes. This is the reason behind his affection for dynamic languages, test-driven development, code generation and agile processes. Niclas started generating code with self-made generators about five years ago and has also developed an open-source multi-purpose pluggable code generation framework. Blog at http://niclasnilsson.se
Jon-Erling Dahl, Consat Engineering AB: Jon-Erling Dahl is a zealous senior developer and architect at Consat Engineering AB, a provider of telematics solutions for Volvo Bus Corporation. Coming from a background in soft-core embedded systems, he is now exploring the advanced patterns of distributed software on various platforms. Jon-Erling is enjoying the intermittent elegance of software and is striving for simplicity in code. He has created code generation tools for several years, from simple configuration file generators to pluggable code generation frameworks. Within the telematics field, he has realized that using one source to generate code for several different platforms and languages dramatically increases productivity.