I've just spend the last hour writing a code formatter. Now, enough hot air and wasted energy has been expended arguing the relative merits and demerits of each style, and I'm not going to join the fray. The sole relevant point is that the style you are used to is important. It helps make code more readable, and - as it's a known fact that reading code is harder than writing it - anything that helps make code more readable is a bonus.
My own style has changed and evolved over the years, just like anyone else, and if I was willing to put in the effort I could probably adapt to the styles used in the Quake codebases in a matter of a coupla months. But until then I'm working at a lower speed, reading code that looks strange to me, and wasting time by reformatting it as I go. Even worse, the Quake codebases can be a mish-mash of different styles, depending on who was working on them at any given time.
I'm not doing this for money and it's not my day job; if it was I would put in the effort to adapt, but that's not the case.
So after hunting down various reformatters on the web I've decided to write my own. Why? Cos the others are all rubbish. The only GOOD reformatter I've ever seen is the one built into Visual C# (and presumably VB, but I've no exposure to it) 2005 and above. Precise control over all the important things. The others are too limited, and/or impose their own idiosyncracies, and sometimes even add injury to the insult by making you pay for them. This way I can target specific things that drive me batty in the Quake codebases and adjust them to specific outputs that I feel more comfortable with. What other people like or dislike is their own business.
Thursday, July 9, 2009
Of Holy Wars And Righteous Indignation
Posted by
mhquake
at
10:16 PM
Subscribe to:
Post Comments (Atom)
5 comments:
HOLY COW!!!!
Are you actualy saying that indent is limited. I'm eager to see your completely awesome code formatter so i can drop that lines of my makefiles.
You're saying astyle is crap? I strongly disagree!
Yes, indent is too limited for my requirements. And yes, astyle also fails to meet them. If either are suitable for what someone else wants from them, then I have no objections. But they fail for me, so therefore they are useless so far as my requirements are concerned.
My "totally awesome code formatter" by the way is designed to address certain very specific issues in code style with very specific solutions, i.e. it's not a general purpose tool. I thought that was clear but apologies if it wasn't.
I continue to be shocked about the limitations of indent. Maybe my needs are more "standard" than yours, but i can't find anything missing. I didn't want to impose nothing, just found your post sightly offensive/disrespectfull with these tools. While you continue "praising" the goods of other tool that also didn't fill your needs, actualy that part has become part of your sign on the blog so whathever.
What do indent or astyle need to fit your needs? These are as open as the quake engines you are fidling with. Maybe it would be more constructive to patch these instead of diminishing them. Maybe you would do nothing with them, and that's also a completely valid choice.
You were completely clear about your unique needs on your code formatting, i was just joking in that part, no apologies needed on that.
Parentheses and operators? From the link you posted indent doesn't do those, and so it is too limited for my requirements.
Post a Comment