Tuesday, August 25, 2009

TimeTrak: The Webserver

Whenever you do web development, you will inevitably have to use a web server. I use the term 'web server' to generally mean HTTP servers, webservers, and application servers. If your website only dishes out HTML and other static content without server-side processing, you probably just need an HTTP server. If you expect dynamic content and server-side processing, perhaps a webserver is what you need. If you'll be running (web-oriented) programs and services, heavyweight back-end processing, or on vendor-specific stacks, etc, you should research application servers. Application servers can do everything webservers do, and webservers can do everything HTTP servers do.

The choice of a web server depends on the programming language that will be used to implement the business layer (applications, data processing, business rules, generation of content, etc). Don't forget that some web servers might be supported on specific operating system platforms as well e.g. IIS is a Microsoft-only deal. Others can be vendor-specific, requiring you to use their database programs or hardware. Web servers can cost anywhere from free/open-source (e.g. Apache Tomcat) to very expensive enterprise class subscriptions (e.g. Microsoft Web server). The cost is usually for value-added services and features beyond basic web-serving such as multi-processor support, load balancing, clustering, security, availability/redundancy, technical support, or other vendor-specific bells-and-whistles.
The web server is where your application architecture is implemented. The web application will depend heavily on the services provided by the web server, including database access and security.

TimeTrak shall be implemented in Java, and will only need a webserver such as Apache Tomcat. With this setup, I can use the JSP/Servlet container to generate dynamic content, and a JDBC-compliant driver to access the database. I can use the full power of the Java programming language to implement the web application. The business layer shall be implemented with Spring MVC, and data layer with Hibernate. Your choice of web server must support your architecture decisions squarely. This is why some businesses prefer stacks such as those from JBOSS, IBM, or Oracle. Other decisions you must consider before choosing a web server include: how you will be building and deploying the application, testing strategy, and security. Make sure your customer is on-board with the decision, as it is potentially the most expensive if you had to change things completely.

A note about security: after installing a web server, take time to lock it down, as it is the gateway to the outside world. A lot of website security breaches take advantage of web server default settings and other vulnerabilities for which patches and best practices would have saved the day. Make sure you are aware which ports the web server opens, or operating system services it depends on, and secure them accordingly.

Other reading:
http://www.sun.com/bigadmin/content/developer/howtos/webserver_part1.html
http://tools.devshed.com/c/a/How-To/How-To-Choose-The-Web-Server-For-You/
http://webdesign.about.com/cs/webservers/bb/abwebservers.htm

Wednesday, August 12, 2009

TimeTrak: The Database

I love free things, and I love good free things. When it comes to software development, there are tons of free options for most pieces you will need to build your applications, and building TimeTrak will be no exception. I'm choosing to use the MySQL database server for this project because I am familiar with its reliability, scalability, performance, and simplicity (all awesome). They also provide a Java connection driver and a bunch of other free tools to manage the database.

To be impartial, I've also checked out, used, or heard of these other free database applications that some might find more appealing than MySQL. Heck, I'll use any database that is relational, is SQL-compliant, has a driver for my programming language, is known-good in the industry for the kind of application I am developing, and is (almost) free - unless the project requires using a specific product.

The free database applications:
  1. PostgreSQL: Extremely scalable, open-source, object-relational.
  2. Firebird: ANSI SQL-99 features, Open-source, freeware, based on Interbase.
  3. Apache Derby: Open-source, implemented in Java.
  4. H2 Database Engine: Open-source, Java SQL database engine with embedded, server and cluster modes.
  5. Hypersonic SQL: Open-source, created in Java, small. No longer being developed, but existing versions work well.
  6. SQLLite: Self-contained, embeddable, zero-configuration SQL database engine. Great for desktop applications.
  7. Microsoft SQLServer Express: Lightweight version of Microsoft's commercial SQL Server database.
  8. Oracle Database 10g Express: Freeware edition of Oracle's high-grade 10g database.
Additionally, I always have DBVisualizer installed alongside database applications, mainly to visually inspect the schema. The free edition allows running only one SQL statement at a time. To run .sql files, I just use the MySQL command line console. Each database application will have a different set of management tools, so do your research.

Finally, perhaps it's nothing to worry about, but the future of MySQL long term is uncertain. The company was bought by Oracle, and I suspect they will want to monetize the acquisition. They make expensive and enterprise-grade databases already, and I do not see a huge incentive to keep a (good enough, production-grade) free database around. Time will tell.