Workflow: FDT Templates, Code Snippet Management December 5, 2008
Becoming a Code Jedi, is learning to harness the force hidden inside the language and the tools. One of the more powerful one are templates. Basically shortcuts for generating often used code that can save 20% of coding time and making coding life much less tedious.
Snippets for common things like loading swfs, and templates for how you work are really only limited to your imagination. I frequently use PhraseExpress for my code snippets, it's more wiki like, easier to create navigate having access to the clipboard while I'm working on a project. Templates are better for more solid things, e.g. classes having access to some of the contextual information (like the current class name) or having multiple things to replace (e.g. name and type). Templates are built into FDT/Flex.
Turns out there are many templates on the web, since they are xml they are easy to share.
Some others for FDT:
http://mentalaxis.com/words/tag/fdt/ - getter setter and singleton
http://osflash.org/tags/fdt
Installing:
To install these template, download this XML file, open Eclipse,
On Windows:
Window -> Preferences -> FDT -> Editor -> Templates
On Mac OS X
Eclipse -> Preferences -> FDT -> Editor -> Templates
select Import... and select the unzipped XML file.
Using:
Once imported, you can insert templates by typing the short name e.g. "mem" for "member" and hit CTRL + SPACE to have it take you to enter the fields mode. Watching it fill out the remainder of the live code generation is visually rewarding.
Developing:
Just like leveling up in a game, to get to higher levels, you have to use the tools to gain experience. In busy life, for me it's blocking out some time, periodically reviewing the inventory of templates available.
It also helps to keep something in the back of your head, being able to catch yourself when your doing the same things over and over again. Keeping a list off to the side can help keep track but not interrupt your development.
With my team, and my own framework, I generally about quarterly like to do an internal code review partly to remember all the things I've developed...often I'm so busy that I forget what I've already built! It gives time to improve via refactoring, see patterns exist that often become templates.
Having a standard library of templates can also help keep the team on the same page, it's basically codifying best practices.

Add a Comment: