The World According to Nick
My take on Software, Technology, Politics, and anything else I feel like talking about.
Tuesday, May 18, 2004

Destroying Elegant... no... Beautiful Code 

I'm a Software Engineer. I like to differentiate that from just a Computer Programmer. I went to an Engineering School, I have an Engineering Degree. So what is an Engineer? One definition would be someone who takes abstract scientific concepts and turns them into useful things for every day life. One of the "arts" of Engineering in my view, is the idea of combining form and function. This is something that a lot of Engineers miss. They get it to work, and then they move on. I think that something can not only work, but it can look good at the same time. It can be elegant. For a Software Engineer though, what should be elegant? Should the user interface to your program be the only thing that is beautiful? Or can the code that is used to produce it be beautiful as well?

Think about it. If you've ever gone to a car show at a state fair or something, the people there don't just have their cars out for display, they also pop the hoods. They clean up the engine, and make it look as beautiful as the rest of the car. I've been thinking a lot about this the last week or so because we've been doing a series of code reviews in our group, and it's interesting to see the kind of style that everyone likes to use, and thinks everyone else ought to use. I've also stumbled on a new web log from a Microsoft programmer, and he's been talking about some new features in VS.NET 2005 that are scaring me.

Way early on, I linked to a post from a Microsoft blogger talking about the differences between C# and VB programmers. One of the things he mentioned was that C# programmers tended to care more about how their code looked. They thought it could be beautiful. Now I'm seeing in a series of posts by Cyrus at Microsoft that Whidbey is going to be much much more aggressive about formatting your code for you. I like it when VS.NET adds spacing for me as I'm typing stuff. You know, lines up my brackets and stuff. But once its typed... once I've moved on... Leave it Alone! What annoys me the most is when you copy and paste some code from one place to another, or you try to increase the indent on a section of code and VS decides to reformat it for you. The problem is that if you turn off auto formatting so that it won't do that... you lose the auto-formatting as you type. Why do I have to choose between the two? Cyrus talks about it here.

So once you have some sort of model that allows rich rules you also need to ability to take a section of code and say "under no circumstances shall you format this code. This code carries a certain undefinable beauty under its current form and you shall not touch it".

Unfortunately, it's not clear how one would go about doing this. You could use #regions, or specialized comments //*, but those end up changing your code thus potentially affecting it's 'being' (for lack of a better word).

You could make it an editor feature where you select a region of code and that's remembered in some special file (like breakpoints, etc). However, is that really good enough? What if you transfer that file to someone else. You don't want them mucking around with that formatting. So we need it to not actually touch the code, but travel around with the file. how to do that how to do that...

I want people to be able to pop the hood on my code, and say... That Looks Beautiful.


Post a Comment

Related Links:

About Me

Name: Nick
Home: Wauwatosa, WI, United States

I'm a Software Consultant in the Milwaukee area. Among various geeky pursuits, I'm also an amateur triathlete, and enjoy rock climbing. I also like to think I'm a political pundit.

 View My Profile

 Home Page

Subscribe to this Feed

Search Archives
Previous Posts
Did You Know?
Low Priority
What a Way to Start a Morning
Kerry MIA Again
Blogger Update
Being Unemployed in the Summer
It Can't Make Toast... But It Can Order Pizza
Hard to Manage a Server
Programming with Perspective
Dear John. We're thru :-(

Personal Links
Carnival of the Badger
The Coding Monkey Links
Flickr Photos
Blog Critics Reviews

Blogroll Me!

This is a Flickr badge showing public photos from Nick_Schweitzer. Make your own badge here.


Blogcritics: news and reviews

This page is powered by Blogger. Isn't yours?

Weblog Commenting and Trackback by

Listed on BlogShares

Design By maystar