Software Release: Visual Studio 2008

Yes! Finally, Visual Studio 2008 was released. I have to admit, that I downloaded Visual Studio 2008 Express Editions as soon as I found out about them. So from now on - it is the IDE of my choice.

I didn't have much time to test it yet, but I already noticed a significant performance increase. I'm not really sure if it is the performance increase. Visual Studio 2005, even with the performance fix wasn't performing that well. So, if you are still hesitating - don't! Get the new version and enjoy it!

There is one catch with the official Visual C++ 2008 Express Edition release, though. In the FAQ it says that there are no restrictions on the express editions - you can create commercial applications free of charge. However, the Windows SDK version express editions install on your system is 6.0A release. Now, this is very odd, because 6.0A is the pre-release version. As a general rule with all Microsoft products' pre-release versions - they are only meant for personal-use and testing purposes. So it is actually a mystery to me. I tried asking on Windows SDK forum about this, and I was advised to get the version of SDK that isn't marked as pre-release, so I'm passing this advice to everyone! You should really get the Windows SDK 6.0 release just to be on the safe path.

And now, let's return to our own business. I started a series of articles about making a wizard for the Visual C++ 2005 Express Edition. Now, I don't use that version anymore. However, from what I know already about the Visual C++ 2008 Express Edition I can say, that I will be making the same kind of wizard for the new release. Note, that both editions are very similar, and wizard developed for 2008 will probably work with 2005 release as well (you'll just have to change a few strings in a few files). So, if you were waiting for that series of articles to finish - don't worry! I'll finish it! ;)


Software Update: Visual Studio 2005 Performance Fix

Ah. This is one of the nicest things Microsoft could have done! If you used Visual C++ 2005 (or any earlier version of it) with large solutions and projects - then you definitely know, that sometimes IntelliSense would often slow down things. Sometimes the slow down would be so big, that you'd have to turn off IntelliSense to be able to work on your project.

I haven't tested this fix yet, but I think it's going to be good! :)
And here are the links:
Microsoft's knowledge base article about the issue,
The actual fix download page,
A very nice VC++ Team Blog article giving more detailed explanation of the changes.

Note, that you will have to sign in to your passport account before you get access to the download page.

And once again - thank you Microsoft! :)


Customization: Custom Visual C++ Wizard - Part II

In the previous part of the series, I explained what I don't like about the default VC++ Project wizard. I also defined how those things should be fixed. So, by now, we have some requirements defined for our final wizard project. Let's continue planning our wizard.

So, what kind of projects we will be making with this wizard? Well, the most basic option should be there to simply create the Solution. When creating solution, it should also create directory for the source code, and add the common headers there. Now, we are facing the first problem. Visual C++ Express Edition doesn't support Solution Directories (or solution files), which means, that we either have to create a dummy project that would contain those headers, or we will not see those files in Solution Explorer window. Personally, I prefer the first option. So, our empty solution will not really be an empty solution - it will have a dummy project (I'll call it "Solution Project") and this project will contain a few header files.

What else? Well, as I mentioned in the first part - I like to have all my projects as a set of libraries, so the next obvious project type we'd want to generate is a Library. There are a three kinds of libraries I will want to generate. The only difference in those three will be the output file it generates. Now, if you remember the first part - I said I want four configurations (Debug Static, Debug Shared, Release Static and Release Shared). Basically, each configuration name describes perfectly, which C/C++ runtime the configuration will link to. I hope I don't have to explain, why linking to the same version of runtime is important across all projects in the solution... So, the three library kinds will be: Static Library, Shared Library and Mixed Library. You are probably wondering what the heck are those. Well, let me explain. In Static Library project, all four configurations will generate a static library (LIB file). In Shared Library project all configurations will generate a shared library (DLL file). In Mixed Library project, however, the both Static configurations will generate static, and the Shared configurations - shared library. In addition, when creating a Library project, I might want to create a Unit Test project for it too. Now, I know that not everyone likes to write unit tests, but I do, so I'll need this option.

Finally, the last kind of project is an Application. I can think of two application types - Console Application and Windows Application. I think those are obvious.

So what else can we plan? In the first part, I described what the directory structure should look like, but I didn't discuss naming issues. You see, when creating directories or naming files - there are a few things to be careful with. There are all kinds of special characters that you can not use in those names. Also, it is a bad idea in general to use paths with spaces in projects. So, whatever I enter as a project or solution name - it might not be possible to use them as the directory names and solution/project file names. So, the wizard could generate safe names for us. It could generate them, but it could also let us edit those names just in case we want that. Also, if I'm creating a library called "PM's Standard Library" I don't really want to include headers from that library by prefixing "pm_s_standard_library/". So, we will also need an abbreviated solution/project name.

Having discussed all that, I think it's time to start designing the pages of our wizard. However, that's the thing we will talk about in the next part of this article series. Stay tuned! ;)


Customization: Custom Visual C++ Wizard - Part I

As I told you earlier - I am using Microsoft Visual C++ 2005 Express Edition. Unfortunately, this version of Visual C++ has some limitations. One such limitation, is that you can not design custom project (or item) wizards with it and for it. However, a creative person such as me or you, might still figure out the way...

Yes, that is true. I know how to add wizards. I will try to make one such custom wizard and in the process of making it - I will post articles about what I'm doing.

So. What is the first thing you should do, when making a wizard? Personally, when I figured out how wizards work - I started making one. Planning is for pussies, right? Wrong! Plan every single thing in your wizard. It is very frustrating, when you have to start over and over again.

Ok, so let's start from the list of annoying things in the default (console project) wizard. Here is my list:

  1. The default Debug and Release configurations.
  2. Default settings in those Debug and Release configurations.
  3. Solution and project directory structure.
  4. Default generated code.
I'd be interested to see your lists (it might give me ideas), so please - feel free to leave a comment. Thanks! Now, let's proceed.

Here are the explanations of each item on my list:
  1. I always break down my projects into small libraries. When I start developing those libraries - I never know if I'll want static library (LIB) or shared library (DLL). Also, I don't know which run-times I'll want to use in my final application (they can also be static and shared). So, it would be great if I could have a project with both. It means, that I want to start with four configurations: Debug Static, Debug Shared, Release Static and Release Shared. It doesn't really matter what kind of project I'm making - I always want these configurations.
  2. Now, when I'm writing my code - I always set the warning level to the max (level 4). Whenever I create a project with the default project wizard - I spend 15 minutes or so going through Project settings. That is wrong! I want the wizard to set the correct values for me, so that I can create a project and start coding!
  3. This is the tricky one. By default, Visual Studio solutions and projects have this directory structure:
    [solution] - top level solution directory;
    • [config] - each solution configuration gets it's own output directory;
    • [project] - project directory;
      • [config] - each project configuration gets it's own intermediate directory;
      • [project].vcproj - project file;
      • *.cpp, *.h, *.rc and so on - source files are all in this directory as well;
    • [solution].sln - solution file.
    Am I the only one concerned about the fact that intermediate files are placed in the subdirectory of the source code directory? I mean, when you hit "Clean Solution" - VC++ never cleans all of the files. There is always something left in that directory. So if you want to create a source code package (for whatever purposes), you have to manually delete those files. And the binaries? They are placed in separate directories in the top-level solution directory. Let's summarize. Here's how I imagine the perfect solution directory structure:
    [solution] - top level solution directory;
    • bin - executables (EXE and DLL files);
    • lib - libraries (all LIB files - DLL export libraries and static libraries);
    • src - source directory;
      • [solution] - top level source directory (so that we can have includes like this: "[solution]/[project]/[file].h");
        • [project] - project directory;
          • [project].vcproj - project file;
          • *.cpp, *.h, *.rc and so on - source files are all in this directory as well;
        • *.h - some common configuration headers;
    • tmp - intermediate files;
      • [config] - each project configuration gets it's own directory;
        • [project] - each project gets it's own intermediate directory;
    • [solution].sln - solution file.
  4. Seriously, is there anyone who uses that default code? I talked to a few coders I know - they all say that they always check "Empty project"! The code is just wrong. It could be so much more useful. Anyway, we will make a wizard that will add a lot of useful code for us (it will be preprocessor macros, mostly).
So. I have defined what I don't like about the default wizard and I've defined how those things should be fixed (how they will work in my own custom wizard). This is it for today. The second part of the article series will follow shortly.


Something Obvious: Learn Your Tools

Yes! Learn your tools. It's amazing how many wannabe programmers who are just starting aren't really willing to learn their tools. Now, by tools I mean tools like compiler. Usually, if the compiler gives them a warning - they would rather learn how to disable that warning, instead of learning how to fix the code so that the compiler wouldn't give the warning anymore.

Let's say you are driving the car. Suddenly, on the cars panel, one of the lights starts flashing. You look at the light - it's flashing because you're out of gas. Now, what do you do? Do you disable the light so that it doesn't annoy you anymore, or do you fill the gas-tank?

Same with programming. All compilers, these days, are pretty smart. They're pretty good at detecting smelly code. And when they do detect such code - they issue a warning. Now, compiler doesn't do that only to annoy you. It does that because it actually wants to help you! Compiler is your friend!


The Tools: Documentation generator

The tools I've discussed so far have obvious use for every developer. This one, however is something different. Most programmers do not use any source code documentation generators. Heck, I started using one only a few weeks ago! I like it so far.

So, what tools should you consider, when you're developing applications with C++? Well, the first one I thought of was doxygen. It is probably the most popular tool in the world. Most of the open source libraries use it. You want my own opinion? Well, it sure can parse C++ code, though it generates some stupid warnings occasionally. The actual documentation comments are ugly. I mean, really, writing commands like \ref or $ref is ugly. If you're reading The Code, and not The Documentation - the comments are very cryptic and hard to read. Another thing I should mention is that I really don't like that doxygen doesn't let you customize the look of generated documentation. I would really love if it would let me fully customize the generated output (by supplying my own templates for class, function, member, template class and so on).

Another tool I've found was Natural Docs. Now, the first thing I want to say is that the documentation comments are great! It doesn't have any commands or tags. When you look at the source code - it just look like normal comments. However, the tool isn't perfect either. Its' support for C++ language is far from perfect. On the web site, it says that the update in this area is planned, though. So, when they implement full support for C++ language - this tool will become the best tool. But right now it's barely usable. Also, just as doxygen, Natural Docs doesn't let you customize the generated output. Oh, and the supported output formats are fewer.

There were some other tools I've looked at. Some of them look nice, some of them are awful, but none of them deserve a separate paragraph in this blog-post. Anyway, here's is the list of tools worth mentioning:

There aren't that many tools that generate documentation from source code...

So, what is my final word? I choose Doxygen. I will be keeping an eye on Natural Docs, but for now, I choose Doxygen.


The Tools: Text and Source Code Editor

Although IDE is the main tool to edit the source code, in some cases, you might need a good text editor too. Sometimes you just need to edit some text files (readme, license or something else), in some cases, you might even want to edit the source code without firing the IDE - a good text editor with syntax highlight is very handy in such situations.

Everyone could simply get away with Microsoft Notepad, although it's crappy if we talk about source code editing. The best free editor I've used so far is Notepad++. It isn't all that great all by itself, but it has some plug-ins that turn it into a very good source code editor. Namely, the Function List, TextFX and Light Explorer plug-ins are great!


The Tools: Version Control System

Version Control System (VCS) is a must for every computer programmer, even if he's not working in a team. It is important for a coder, because coding and experimenting are inseparable sisters. Sometimes, experiments fail and you have to (or at least - you want to) go back to where you were three days ago. Usually, in such situations, a coder would get really frustrated because he doesn't have any backups. However, if you are using VCS - you all of your backups. You jest check the log, figure out which revision do you need, and then you can easily roll back to that revision. I don't think I have to explain why it is a must when you're working in a team...

So, what is the VCS of my choice? It's Subversion (SVN) + TortoiseSVN. Yes, I have heard about Perforce, and it is probably very good (because there was a lot of people who suggested it on various forums). However, Perforce is not free (you have to buy the commercial Perforce license if you want more than 2 users or 5 workstations) - although I'm working alone, some people might join me in the future. Also, I don't really want to limit myself to open source projects - I might want to release some closed source projects as well. So, I just use the most popular free tool on earth.

Well, actually, I didn't really choose SVN - I already had it my computer (because of some open source projects in which I participate), so I'm really familiar with it and I don't really want to install anything else.

One thing to note. If you're worried that your computer might die one day - you can make backups of your SVN repositories. Personally, I make one backup each week - I actually sleep better that way.


The Tools: Integrated Development Environment

Integrated Development Environment (IDE) is probably the most important tool. It's the tool that you use to accomplish many things:

  • Managing the projects.
  • Managing build settings for your projects and individual files.
  • Code writing.
  • Building.
  • Debugging.
So, what IDE do I choose? I choose Microsoft Visual C++ 2005 Express Edition. Why you ask? Well, first of all - it's the best free IDE for my platform. I only code on Windows (though, I always think about portability while coding). I do not use the .NET features (C++/CLI), but it still is the best tool. It takes a little time to set it up (I have to manually download the Platform SDK and DirectX SDK) but I think it's worth it.

Before Microsoft released this great edition for free - I was using all sorts of other IDEs and compilers and was never happy about them. The thing is - whatever IDE you are using - it must not get in the way. It must be intuitive to use. Other IDEs couldn't give me that. So, most of the times, I was using the free Microsoft Visual C++ 2003 .NET compiler (can't find the link anymore) and I was writing makefiles by hand (that's right!). But when the free 2005 Express Edition came out - I pick it up very fast, because it was very intuitive. I didn't have to spend hours struggling to figure out how to properly configure everything - it just worked right after I installed it.

As a last note, I'd like to point out, that although Microsoft Visual C++ 2005 Express Edition is stripped version (you can't use plugins), but it still has some extensibility features. One of them is that you can use the custom project wizards, and the other is that you can extend it with some external tools that it can run in the build process. If you think that these two are minor features that no one is using - you are wrong. After I experimented a little with them - I developed my own custom project wizards and I added some third party tools into the build process (the one I use the most is the UPX tool to compress my release binaries and I can configure it just as I configure the C++ compiler settings - in project properties).


The Tools: Intro

So, I decided that the first series of articles I'm going to write is about the development tools. It is important to choose wisely. Basically, it isn't just about "choosing the tools that meets your needs". You must actually look forward and keep in mind that some time in the future your needs might change. If that happens, you might find yourself struggling with the limitation of the toolsor you might need to migrate your work to some other tools.

Personally, I already have the tools set up and ready, but I want write about how and why I chose them instead of some other alternatives.


Starting the blog

I was never eager to start my own blog. I always considered blogs as a waste of time and I always though that it is a real pain in the ass to maintain one. However, I have to agree, that it is, by far, the best way to publish and exchange ideas. Yes, ideas! Oh, how many times I had The Best Idea Ever and then next morning totally forgot about it. So here I am - starting my own blog, so that I could publish my ideas, respond to other bloggers and let people know that I exist.

My name is Paulius Maruška. I'm from Lithuania. I am 24 years old. I'm studying Informatics (something similar to Computer Science). If you are wondering how do I look - you can see my picture on the left. Yes, that is me. As you can see I'm a nerdy looking guy. Oh and, before you ask - no, I don't have a girlfriend - I'm a True Nerd! ;)

What will be the content of this blog? Well, first of all - I love to write C++ code. So you can expect a lot of stuff about it. You can also expect some random ramblings about something else. I often find myself pissed off by some stupid politicians or celebrities and I want to let everyone know what I think about them. But for the most part - it will be about programming.

So, that's it for now. If you're a programmer like me, and you have your own blog somewhere - leave a comment, I promise I will bookmark it and I promise I'll check it out. Take care!