thecrumb

developer | thinker | tinkerer

Sorting It Out (more readable code)


With my latest project I've been dealing with big property files using ColdFusion ORM. What invariably happens is properties get added, removed and eventually you have this big file of jumbled names which is really difficult to scan through.

I was tinkering with Notepad++ ( a great text editor ) and noticed it had a plugin to sort text...

TextFX > TextFX Tools > Sort lines case sensitive (at column)

This will turn

<cfproperty name="submitURL" ...>
<cfproperty name="date_applicant_signed" ...>
<cfproperty name="special_conditions_limitations"  ...>
<cfproperty name="chair_signature" ...>
<cfproperty name="special_privileges" ...>
<cfproperty name="applicant_signature_confirm" ...>

Into a much easier to scan list:

<cfproperty name="applicant_signature_confirm" ...>
<cfproperty name="chair_signature" ...>
<cfproperty name="date_applicant_signed" ...>
<cfproperty name="special_conditions_limitations"  ...>
<cfproperty name="special_privileges" ...>
<cfproperty name="submitURL" ...>

But going back and forth from CFEclipse to Notepad++ was a pain. A quick search turned up the Sort-It plugin for Eclipse.  After installing it you should have a new menu item on the Edit menu > Sort.

I've found this is really handy for sorting properties, variable declarations, CSS, etc.


cfhug Simple Loading Dialog w/jQuery UI

More like this...