Should I Code My Website From Scratch?

Should you build your website from scratch or should you use an alternative? I share my thoughts as a PHP developer.

In the old days coding a website from scratch was the norm. Today there are alternatives such as WordPress and frameworks such as CodeIgniter. If you are a student this could be a good learning opportunity. If this is a business website, I would recommend considering your alternatives.

I have been a PHP developer since 2006 and I built my first website in 2000. In those early days, I created websites from scratch. Today there are a lot of alternatives such as, WordPress, Drupal, Joomla, Wocommerce, Drupal Commerce, Magento, and some that have less market share. 

If you are considering coding a website from scratch there is a lot to consider. Let me explain.

Skills 

To code a website from scratch requires a minimum of knowledge and skill. 

You must know: 

  • HTML – Is the foundation of web building.
  • Cascading Style Sheets (CSS) – A working knowledge of CSS is a must when building a website from scratch. The developer will need to know how to make the website look and feel good and any modern website must be mobile responsive. Mobile responsive means the website must be able to be viewed on all sorts of devices from desktop computers to laptops to mobile phones.  
  • JavaScript/AJAX – JavaScript and AJAX make your website interactive. For the entry-level website, these skills may not be necessary. Some JavaScript may be needed for form valuation.
  • A server-side scripting language – This is a necessity. The developer that builds from scratch will need to be armed with a server-side scripting language. The PHP programming language is by far the most widely used language for creating websites and web applications.
  • A data engine/Structured Query Language – If this site is more than just an HTML/CSS/JavaScript website, a data engine will be necessary. MySql is by far the most widely used web data engine. The Structured Query Language (SQL) is how the programmer utilizes the data engine. SQL skills are a must if a data engine is used. 
  • Code editor – A code editor can make a website developer’s life much easier and can speed up the programming process. Code editors can utilize auto-complete and give the ability to do a global search to find other code. These editors usually provide the ability to edit remote code.
  • Local development environment – Unless the website to be built is your basic HTML/CSS/JavaScript website, a development environment is probably necessary. Note that HTML, CSS, and JavaScript run in your web browser so websites that are limited to these technologies can be run locally without having to configure a development environment. If this project is purely for learning, the project can be completed on a publicly facing server. If this is a production website you may want to have 3 servers, one for each of the following, development, testing, and production. 
  • Hosting – Hosting is always necessary when creating a website. Shared hosting is the basic starting point. If you are building a PHP website, you will need a Linux hosting package. At one point or another, I have hosted with GoDaddy and HostGator. They should meet your entry-level needs. I hear Bluehost is a good choice as well for cheap entry-level hosting.
  • File Transfer Protocol (FTP) – If you are creating your website local you will need to transfer it to your server. That is where having FTP skills come into play. For a simple FTP client, I recommend Filezilla.
  • Project management skills – Building a modern-day website requires project management skills. As you can already see there are a lot of moving parts that will require a plan and the ability to execute that plan.

The above skills transcend three and possibly 4 distinct skill sets. In modern web development, 4 skill sets are needed to build, upgrade, and manage a website.

  • Designer – This is the person that uses HTML and CSS to create the look and feel of the website.
  • JavaScript / AJAX developer – In some cases, a Javascript developer might be required if the website or web application is using a lot of complicated JavaScript/AJAX to make the website interactive. If you are using JavaScript for simple stuff like form validation, the scripting developer is probably able to take care of the JavaScript programming.
  • Server-side programmer – This is the person who writes the server-side scripts or the web application code. In my case, I use the PHP programming language. One thing to ensure when choosing a programming language is that the language is readily available by most hosting providers. PHP is very popular and is widely available. The developer may need Object Oriented Programming skills if the code is to be reusable.
  • Hosting server administrator – The hosting server administrator ensures the web server hardware, software, and connections to the local network and ultimately to the Internet are all kept in good working order.

Questions You Should Ask Before Starting Your Project

  • What type of website are you building – Before you get started you need to ask yourself what you want to achieve. Are you building a web application or a content management system (CMS)? What you ultimately wish to achieve, will affect the skills necessary to complete the project.
  • Who is the website for – Is this a project used for learning? Will it be a business website? Is this a do-it-yourself web project? 
  • Time constraints – It will take longer to create a CMS than to use an application that is already available such as WordPress. If you are building a web application it will take however long it takes. Using a framework can speed development. You need to know the deadline for 2 reasons. One, you need to evaluate if it is reasonable, and two, to better understand what path you need to take and to discover how much you can accomplish within your given time frame. 
  • Would an alternative be better – I think I have somewhat covered this already. Let’s dive a little deeper. Say you want a simple CMS. Something like WordPress, Drupal, or Joomla may be a better solution than building from scratch. Let me explain why. If the developer starts from scratch it will take a lot of time and effort to duplicate the features and functionality these alternative applications already provide. They already have user management, content management, etc. These applications can be extended without editing the core source code of the application. And do not forget these applications are very mature and it may have taken the community hundreds of man-hours or even thousands of man-hours to get where they are today. It is not realistic that these features can be duplicated in just a few hours of programming. 
  • Is this an exercise so you can learn web development – If you want to learn web development skills, building a website from scratch can be a great way to learn and show off your skills. As you see there is a lot to learn. For the do it yourselfer, some of this can be streamlined. For example, you will not need to have Object Oriented Programming skills to build your website. Eventually, I would recommend you learn everything I have outlined if you want to build websites for others.

Advantages 

You will learn a lot if you build a website from scratch. The website may require less hosting resources and may run faster. And you will be fully familiar with your code.

If you are building a browser-based web application, building from scratch is a viable alternative to using a framework. Frameworks come with a learning curve that can add time to the project

Another advantage may be creating reusable code for a niche that a developer may be targeting. Once the code has been created it can be used for other projects.

Disadvantages

If this website is a business website, building from scratch may be a disadvantage unless that is what is required. It takes a ton of time and effort to duplicate what is already available. Time to market could be much sooner if you use an alternative such as WordPress or a framework. Time to market translates into cost.

Not using a framework can add time to the project when you take into account, frameworks contain a lot of functionality that can be tapped into and add structure and features you might have to create on your own if you are building from scratch.

Resource Utilization

In the past, my peers and I have discussed server resource utilization by applications such as WordPress. Some of my friends say building from scratch always trumps using a canned application because the source code will take up a smaller footprint and will require fewer server resources.

No doubt creating anything from scratch will make for a more efficient code base that requires less web server resources. However, you have to ask yourself is that a good business decision?  

I am looking at this from a business perspective. It is cheaper to throw a few more server resources at the application than to pay a developer to duplicate what is already out there. 

There are times when building from scratch is the solution, however, for the most part, most websites do not need to be created from scratch.

If there is a viable alternative that will shorten the build time, it should be considered. Manpower is expensive. Hosting servers in comparison are much less expensive and are getting much more robust almost daily.

This did not use to be the case. Until recently, as hardware became more powerful software would jump ahead and would require more power. That problem does not exist today. Modern web servers are very powerful and are less costly than what a developer costs.

I’m a minimalist too, however, we must consider business costs when creating a website or web application.

There are exceptions. In some cases, an application is given limited resources by design. This could be because the application is embedded on a small computer that has limited resources. This is not usually the case when it comes to websites and web applications.

Build a Website From a Template

Utilizing a professionally made website template can reduce the time and effort it takes to build a website. There is a lot of free templates. You can also buy a template. I’ve seen high-quality templates that were between $50 and $100. 

The advantage of using a template that was created by a designer is the HTML and CSS will be much better than most of us nondesigners can create. Add to this the template will be mobile responsive which requires advanced skills.

WordPress vs Build From Scratch

To build a website from scratch means creating the entire code base and the template as well. This could be a lot of work. Since most websites require a CMS, let’s cover that.

First, let’s look at what WordPress beings to the table. WordPress comes with the following:

  • User management – This includes login/logout, password management, and the application’s access control list (ACL). The ACL allows the WordPress administrator to limit access to certain functionality by the class of the user. 
  • Content management – WordPress manages articles and pages. It comes with an advanced content editor, aids the writer by creating the URL of the article/page, and provides for categorizing this content.
  • Widget management – The core functionality allows the WordPress theme developer to add places for widgets. WordPress comes with widget management. 
  • Theme management – The theme is separate from the core WordPress code so it can be changed with a click of your mouse. The theme developer can take advantage of the core functionality and build the theme to be responsive to the user’s needs.
  • Plugin management – One of the principles of WordPress is that no one is to be able to edit the core source code. To extend or modify WordPress, a developer can create a plugin that will interact with the WordPress core system. It is done this way to prevent community updates from overwriting any changes, the user may have made, to the core source code.
  • URL management – When you look at a WordPress website you will see the base domain followed by the article name. WordPress uses the article name to fetch the content you would like to see. This is done by a software router.
  • Add data types – This means a developer can add a data type for whatever is needed. Let me give you an example. Let’s say you have a website that is a mix of articles and business listings. WordPress does not come with a way to manage business listings, however, that functionality can come in the form of a plugin that adds that functionality and creates a data type of business. In essence, by extending WordPress, it has taken on another role that makes it more like a browser-based application.
  • Control panel – All the functionality and features can be accessed via the WordPress control panel.
  • Community – WordPress is made up of a community that manages the source code and the on-site documentation as well as the off-site documentation.

Let me give you 3 examples of the WordPress documentation:

  • WordPress Codex – This is the table of contents that covers : 
    • What You Most Need to Know About WordPress.
    • Learn How to Use WordPress.
    • Working With Themes.
    • Write a Plugin.
    • Give Back.

 You can find the WordPress Codex here.

  • WordPress Theme Handbook – Covers everything you need to become a WordPress theme creator. You can find the WordPress Theme here.
  • WordPress Plugin Handbook – If you are interested in learning how to modify or extent WordPress functionality, they have written a handbook that can get you where you want to go. The WordPress Plugin Handbook can be found here.

As you can see building from scratch must be analyzed so one does not create a project that unnecessarily duplicates what might already be available. 

There are times when building from scratch is the only real solution. Recently I had the pleasure to review a web application that was created to run a multi-million dollar manufacturing business. I’m guessing they spent hundreds of thousands of dollars building this application. I think it was a wise move.

Reusable Code

If the idea of creating a website from scratch is to create a codebase that can be reused, this code must be well thought out and be very modular. Creating truly reusable code is an advanced skill. 

I would recommend following the Object-Oriented Programming (OOP) design pattern. Doing so will allow the developer to create modular code that can easily be reused. 

I would also recommend implementing the design pattern Model View Controller (MVC). MVC is a great way to structure one’s code/project. It makes the code base more understandable and easier to maintain. Another benefit to MVC is it makes it easier for more than one programmer to work on the project at the same time. 

In Conclusion

There is a lot to consider when one sets out to create a website. Should you use what is already available or build from scratch? 

When considering building a website or web application from scratch, I would recommend researching the alternatives before you make a decision.