Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Feature

Postmortem: CodeCleaner

Writing an Integrated IDE Extra

Issue: 3.1 (September/October 2004)
Author: Owen Yamauchi
Author Bio: Owen Yamauchi is a freelance programmer who has been programming REALbasic since version F4. He is the Lead Programmer for Domain Softworx, a company that produces developer tools like CodeCleaner for REALbasic.
Article Description: No description available.
Article Length (in bytes): 9,474
Starting Page Number: 11
RBD Number: 3108
Resource File(s): None
Related Web Link(s):

http://www.domainsoftworx.com/

Known Limitations: None

Excerpt of article text...

I never learned good code-formatting habits when I started programming. Specifically, I never spaced out my code so that it was more readable. As soon as I discovered the feature, I developed the habit of putting all my DIM statements on a single line. Finding the variable I wanted in a mile-long line of them got tiresome very quickly, but the habits were ingrained in my brain by then. I thought that maybe I could write a program that could space out code for me. That was the origin of CodeCleaner.

CodeCleaner's first incarnation was named CodeSpacer. It was a single window with a big EditField and a button. The button had a load of ugly code behind it, not just because it was not spaced out, but because I had not bothered to plan how it was going to work before I started writing it. The full code of the very first build was as follows:

EditField1.text = ReplaceAll(EditField1.text,"="," = ")

(In the actual program, the first equals sign was not spaced, but it is here, per RB Developer guidelines.) When I ran this code on itself, I was appalled. CodeSpacer had spaced out the equals signs inside the quotation marks. Then I realized something else: when I ran CodeSpacer again, all the equals signs would be doubly spaced out. Clearly I had to re-think what I was doing.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com