Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

A Programmer's Guide to Starting a Software Company and Building an Enterprise Application - Article 3

3.83/5 (7 votes)
22 Jun 2009MPL7 min read 45.7K  
This is the third in a series of columns in which I will tell you how I started SplendidCRM Software, Inc.

Introduction

This is the third in a series of columns in which I will tell you how I started SplendidCRM Software, Inc. I hope that my entrepreneurial experience inspires you. In my opinion, the creation of a company can be a wonderful adventure.

Article 3

What does it cost to start a company? Not much. If you already have a computer, you have what you need. From a legal perspective, forming a company can be done for $100 over the internet. If you are forming a non-profit, then the type of business entity becomes easy. However, as a small business, you will likely narrow down to either an S Corp or an LLC. I personally prefer the S Corp, but this is probably due to my age and previous experience. It may be useful to note that my accountant prefers an LLC. Your best bet is to do the research yourself. One place to start is here.

The real cost to start a company is the cost to create and deliver your first product. This means that the real cost is the software required to create the application and the hardware required to test the application. You need to be smart about how you spend your money. When it comes to development software, Microsoft provides lots of free development tools. If you are developing a software-as-a-service solution, then Microsoft can provide free production licenses for Visual Studio and SQL Server as part of their BizSpark program. You can read the BizSpark FAQ. If you don't qualify for BizSpark, then your next best option is the Microsoft Action Pack Subscription (MAPS).

Both the BizSpark and the Action Pack licenses provide a MSDN subscription, which includes lots of software. We use the MSDN to obtain various versions of Windows in the most popular languages. We have tested SplendidCRM on Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008 and even Windows 7. We have tested SplendidCRM on both the 32-bit and 64-bit version of all of the previously mentioned operating systems. Added to the mix, we have tested SplendidCRM in French, Italian, German, Spanish, Portuguese, Chinese and Japanese. It takes some effort to install Windows in a language that you can't read, so our trick was to run the English install at the same time. The screens are almost identical, so while you may not be able to read the words, you will understand what you are being prompted for.

The interesting thing about testing one’s application across multiple platforms and multiple languages is that you end up doing more testing and you end up uncovering more bugs. In the end, you achieve a more robust application. But with such a large test matrix, you will need to make the best of virtualization. I am sure that you have heard of virtualization, but for those who that have not, virtualization allows you to run multiple operating systems on a single server. We have been using VMware for more than 8 years, so we are biased toward their VMware Server product. You should seriously consider the VMware Workstation product because of its powerful snapshot abilities. Microsoft also has a new Hyper-V product in Windows Server 2008, but we found VMware much easier to use. Therefore, get a dual processor quad-core machine with 12G RAM and lots of hard disk space and you will be able to run a bunch of VMs simultaneously.

When it comes to computer hardware, you are not going to get anything for free. The real trick to getting good deals on hardware is to purchase new hardware at outlet prices. At SplendidCRM Software, we are big fans of HP hardware; we have lots of ProLiant servers and lots of HP Workstations. All of the hardware was purchased at outlet prices with a 40% to 50% discount. You could get refurbished hardware directly from HP, but this hardware typically only has a 1-year warranty. When you purchase hardware at resellers, you get the full new-machine warranty, which is typically 3 years for servers as well as workstations. So, check the outlets at PC Connection, CDW and Provantage. eBay is also an option, but we have had better luck with hardware from certified resellers, which have a no-restocking-fee return policy.

That’s all the business advice I have for this article. Now prepare yourself for an abrupt transition to a programming topic.

Stored Procedures

SplendidCRM relies heavily upon SQL Stored Procedures and SQL Views. I believe that you may be interested as to why I made this choice. If you do a search on Bing for “Stored Procedures vs Dynamic SQL”, you will see that a raging debate has gone on for many years. At the top of the list is Andres Aguiar’s Weblog. While it is not my intent to add to this debate, I believe that it is useful to document how and why I used stored procedures within SplendidCRM.

Let me set some ground rules first. Anytime we pull data out of a database, we do so using a SQL View. Anytime we put data into the database, we do so using a SQL Stored Procedure. As a general rule, we put the business logic inside the stored procedures and the views. There are rare exceptions to these rules, such as the use of a stored procedure to read IMAGE or BLOB data, or the use of direct UPDATE statements when dealing with custom fields.

The primary motivation for putting the business logic in the database is to increase performance by reducing the network traffic and by letting the database do what it does best. A relational database is all about relations, so the best place to put relationship logic is in a SQL view, where the relationship can be defined in the language of the database. Some individuals believe that it is never a good idea to put business logic in the database, and to these individuals I present SplendidCRM as the example of the right time to do so.

Another key motivator for using SQL stored procedures and SQL views is to allow each database platform to have its own implementation. SplendidCRM currently supports the following database platforms: SQL Server, Oracle, PostgreSQL, MySQL and DB2. The procedures and views then become the data-access layer, whose definition provides the necessary separation between logic and data. While there is a little code in C# that handles the differences between the database platforms, the major difference is handled by a separate set of stored procedures and views.

Now that we have the database completely abstracted, the fun can begin. We can query the metadata of the database and create C# wrappers around all stored procedures. The C# wrappers provide strongly-typed functions that can ensure that the right data type is used at all times. And, in the event that the data type changes, the C# compiler will generate an error at compile time instead of at run time. We also use this metadata when importing data. It allows us to ensure that the proper field names are used without having to manage our own list of available fields. The SQL views provide a similar amount of metadata and allow us to dynamically provide lists of available fields so that we can provide our users with a Report generator.

One of the biggest debates regarding stored procedures vs dynamic SQL has to do with performance. The best evidence that I can provide is a comparison between SplendidCRM and SugarCRM. We have found SplendidCRM, which uses stored procedures, to be twice as fast as SugarCRM, which uses dynamic SQL. If you don't believe me, then I encourage you to experiment for yourself. While SugarCRM has been optimized for the LAMP stack, you can install the SugarCRM Community Edition on a Windows Server using a Microsoft SQL Server database. That would rule out the operating system and the database platform as possible reasons why SplendidCRM is so much faster. While some individuals may argue that C# is faster than PHP, I am going to assume that they are equal. This assumption leaves only the difference in architecture, and then the conclusion proves my point that stored procedures are better.

I hope that you have enjoyed this third article in the series. Please watch for article 4 within the next few weeks.

History

  • 22nd June, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Mozilla Public License 1.1 (MPL 1.1)