Put your name in space

Sorry to be so quiet on the blogging front. Working at getting a new business off the ground and writing a new software application is time consuming to say the least. Speaking of software, I am just about done to release the first version of an AutoCAD productivity software package. If you would like to beta test, please drop me a line at joshua.modglin AT inmotioncon.com.

Okay, now to the blog. When programming, have you ever noticed how nice and neat everything is ordered? For example, if you want to get AutoCAD Civil3D’s styles you would go to:


Whereas, if you wanted the AutoCAD document (drawing)


And look under the Application class.

So neat and orderly. How do they do that? They use what is called namespaces.

Believe it or not, you are used to namespaces already. If you have ever stored your data in an orderly fashion on the computer, you would have created directories and stored the information in certain directories. All then they have done is use namespaces to logically store data. How can we do that?

In your application’s properties, you can enter the root namespace which may be sufficient. However, if within your application you want to get more precise then your root namespace you can actually add a namespace to any item within your project. As you can see in the figure, the root namespace is: InMotion.IMSolutions.AutoCAD

However, in the second figure you can see that I have added a more specific namespace named, Licensing.

Why is this so useful? Well, if you ever plan to use these tools in other applications, then you will want the tools stored in an orderly fashion. For example, you can see in the second figure that I am actually Importing a namespace from another set of tools in another project (InMotion.IMSolutions.Functions). Since I have created a logical namespace already, everything is nice and neat. As you can see in the third figure that it is easy for me then to call a class within a namespace. They are all located within the InMotion namespace!!

Some Best Practices

It is usually best to have your company name first (as the parent ‘directory’) then your software package name and then more specific as needed. For example, my company name is InMotion. My software package as a whole (there are three more ‘suites’ coming) is called IMSolutions. Then I got more specific – the tools for AutoCAD, Licensing (like in the above figure) or just common Function tools, etc.


For more reading about Namespace Best Practices see http://msdn.microsoft.com/en-us/library/ms229026.aspx


By the way, I have spent a lot of time on formatting  and good coding practices but not so much actually showing code. Would you like to see some code? What would like to learn about? Drop a comment and I will write a post based upon your request.

Comments are closed.