Rethinking Visual Studio as a development tool

Well, I have used Visual C++ or Visual Studio for about 20 years.
On Windows platform, Visual C++/Studio was the tool you should choose to create Windows apps on Windows. Borland C++ was very good, but to me Visual C++ was the right tool because it was MS which created the Windows and introduced technologies for Windows. Borland should talked with MS to implement the latest MS technology for Windows.

However, since I used the Visual C++, I got impression that coding for Windows was kind of dirty job. Why? I didn’t “recognize” the reason clearly so far. However, recently I started to open my eyes and finally saw the reason.

If you override member functions, windows message handler, event handler and so on, the Visual Studio automatically generates those and put those in header files and implementation files. What makes things dirty is that Visual Studio just put new methods and new variable to the last line of the header file of interested classes. For the Visual Studio developers, it would be the easiest way of implementing the code generation.

class CMYClass
{
    // Member Variables
private :

protected :

public :

   // Member Functions
private:

protected :

public :

}

or

class CMYClass
{
private :
    // Member Variable
    ...

    // Member Functions
    ....

protected :
    // Member Variable
    ...

    // Member Functions
    ....

public :
    // Member Variable
    ...

    // Member Functions
    ....
}

Things can be complicated because there are Windows Message handlers, event handlers, overriden functions, the methods of the class itself.

Whatever it is, the above two organizations make it easy to figure out what the class does.
Maybe it is not Visual Studio developers’ concern. Any programmers who use VS should not rely on the automatically generated codes completely. Once they are generates, individual programmers should organize the codes better way or more manageable way.

Also, I found out that #pragma mark used by Xcode was very convenient and very good to manage codes.
Especially when you migrate old codes to a new codes, you need to make sure if there will be any missing functionality. Then marking group of methods with #pragma mark in Xcode helps a lot. It provides easier way to figure out what existing classes do and how they are organized.
It also DRIVES people to organize their codes. With Visual Studio, it is very easy to have related methods placed here and there in implementation file, *.cpp. However, if #pragma mark is introduced, people will start organize their member functions under related mark tags.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: