Way of web development


Personal Web Server(?) age

When I was doing web development, that time was mostly static pages, with no CSS, a little JavaScript. The only interaction was CGI form. Then I learnt VBScript for ASP and Microsoft Access and used Personal Web Server.

Designing page layout was like hell, everything was using table. The font style was hard coded. So, the HTML source is too messy.

LAMP age

Then, from Personal Web Server, the web server was upgraded to IIS. Next was XAMPP on Windows, using all open source solutions: Apache, MySQL, and PHP. That was a great solution. Unlike ASP, PHP has more functions, more libraries, supports object oriented, syntax similar to C and C++.

JavaScript was not frequently used (in my case), until the usage of XMLHttpRequest (XHR) and AJAX, dynamic content became more attractive. The usage of CSS makes the HTML source much cleaner. JavaScript frameworks became popular for web application development. Some of the frameworks provide better user interface and animation effects. I used MooTools, jQuery and jQuery UI. In my opinion, jQuery is the best because of the element selection syntax is based on CSS selection. It is a great solution to enhance the built-in JavaScript.

To build the web applications, there are web application frameworks too: Ruby on Rails, django (Python), CakePHP (inspired by Ruby on Rails), etc. I personally prefer CodeIgniter. These frameworks are using MVC architecture, including ASP.NET MVC. Instead of static pages, URI routing is used. The developers need not to repeat the source code for similar pages, but using template engine and URI routing, developers only need to focus on the MVC design. Moreover, the web frameworks have their own APIs, the developers should learn how to use these APIs. So does the database, by using the framework APIs, it is possible to change the database from MySQL to PostgreSQL with a little modification.

With the CSS3 and HTML5, web application development becomes much easier. They become more interactive with JavaScript, more elegant with CSS effects.

Other than the frameworks, content management systems such as Joomla!, Drupal, and WordPress were very popular. They allow users to manage their own websites by focusing on the contents only. The developers are usually working on modules to provide more functions to the system, and the web designers will design the themes.

MEAN age

And now, the new trend is the MEAN stack instead of LAMP: MongoDB, Express.js, AngularJS, and Node.js. This solution is seriously different from LAMP. Node.js is not only a web server, but also a server-side JavaScript runtime environment. Unlike client-side JavaScript, JavaScript language is used at the server-side, and it can use the modules which can be installed by using npm (JavaScript package manager). As a result, both client and server sides are using JavaScript.

On the other hand, Express.js is the MVC web application framework. The URI routing and displaying the contents to the users is handled by Express.js. It can use different kinds of template engine where Jade is the default template engine.

AngularJS is a web application framework, which is different from jQuery or JavaScript modules from npm. AngularJS provides MVC architecture to the client-side, so that the view (HTML and CSS) are separated from the controller and model. The greatest feature is the data binding which will make real-time changes to the view. Using jQuery, we need to use EventListener such as onChange(), onKeyDown(), etc. But AngularJS magically omits this phase (demo).

NoSQL is the new trend because of big data. MongoDB is the document-oriented database, which is classified as NoSQL. Relational database management system (RDBMS) such as MySQL organises the data in the table form. As a result, sometimes the design of the database structure is very rigid and causes further changes of the web application becomes difficult. MongoDB does not require table structure, each collection (just like a table in MySQL) has various objects (just like rows of a table in MySQL). Each object is a JSON-like object, specifically BSON (Binary JSON).

Epilogue

Web development is like an ocean. There are various opportunities using web technology, such as WebGL for 3D computer graphics on the web. There are also alternative web servers: Nginx and Apache Tomcat (for JSP); alternative server scripting languages: Perl, Python, Ruby; stylesheet languages: Sass and LESS. It is also possible to develop new wonderful plugins for the web browsers to perform unusual tasks.

Some command-line applications uses web user interface (Web UI) instead of GUI, eg uTorrent Server (for Linux), httrack, Syncthing, etc. This is because HTML is more common than GUI widget toolkits. GUI widget toolkis such as Windows Forms, Qt, GTK+, etc requires runtime libraries. Web UI requires only a modern web browser.

WebKit is a very interesting thing. It is ported to Qt and GTK+, so that Qt and GTK+ can embed the web view in the native applications. Furthermore, Android has WebView class that uses WebKit too, to embed the web view in the native Android applications.

As the trend of big data and IoT, server-client is everything. Linux can be lightweight and focusing on running servers only, including all the logic, running on a single-board computer like Raspberry Pi or C.H.I.P, without any graphical user interface; Web UI allows administrators to manage the Linux server; the devices can connect to the Linux server and perform their tasks systematically.

Framework or not?


Long time ago, I was learning CakePHP, then followed by CodeIgniter. Due to the restrictions using the framework such as naming convention, strict function calling based on MVC model, I decided to write my own personally framework from the scratch. The experience was very nice. Because I learnt about the caching, MVC architecture, function arguments in PHP, etc. But the development became gradually inactive.

After several years, recently I am trying back CodeIgniter, and now I conclude that, framework, though it is not required, it is strongly recommended. Why?

Faster

Writing PHP web application from the scratch, meaning that you have to write my own libraries, classes, functions, or search for the suitable libraries. If using a framework, what you need to do is just learning, and writing some libraries, classes, or functions that suit to the problem. Assuming you are doing a big project, doing it alone is impractical. That is why you need a group of people to do the project. And, those open source web application frameworks are already build by a group of people. That is why, this reduces a loner’s workload. Hence, this allows the development faster.

Larger

When the development is faster, meaning that the development can target on the higher level development, that is, developing applications instead of modules. Moreover, the project can be even more larger.

(I personally prefer low level studies, yet in the real world market, end user products are more attractive.)

More secure and stable

Like what I have mentioned, doing a project as a loner is totally impractical. Because one cannot do a thorough test to a project. One cannot ensure that most bugs are fixed. One cannot write the libraries for validation, encryption, caching, template engine, etc. Using an existing framework, they are tested. Furthermore, with the community support, the bugs are reported.

Production

If you are targeting on the production instead of research and studies, then framework is a need. From the raw materials to the products, it a long way. Unless it is low level product such as a small library.

 

Just like one would like to learn more about Linux, then he/she may learn to install Linux from the scratch. However, for a company or an organization, installing Linux from the scratch for each computer is unfeasible. Creating our own distro is interesting as we can learn a lot. Yet this will only benefits to ourselves directly, and may benefits to others in the long term. Using an existing distro will benefit to a company or organisation directly, because the distro can be used for work immediately.

So, how to choose a web application framework? Before choosing a framework, the best way is to get the reviews from other users. Then we can try some of them, and “feel” which framework is suitable. Experiencing multiple frameworks allows us to know the similarities and differences between the frameworks. Similarities are usually the common features, differences are the uniqueness. So, let us enjoy the web application frameworks: Ruby on Rails, Django, Express.js, etc.

TinyMCE plugin: inserttab


I wrote a small plugin for TinyMCE, to solve the “tab” problem. This is because, in the TinyMCE editor, whenever I press “tab”, it will navigate, instead of insert “\t” in the editor.

After some understanding with TinyMCE API, then I wrote this plugin.

Usage:

  1. Add the inserttab plugin button to the toolbar, in the HTML Javascript. This will show a button with “\t” image in the editor.
  2. Click the button to enable the feature.
  3. Then, whenever we press “tab”, if it is preformatted text, then it will become a real tab, “\t”, else will be filled with “    ”.
  4. To turn off, just click the button again.

The plugin is BSD license. It can be downloaded here.

Favourite web development frameworks


There are a lot of frameworks available for web development. For PHP, there are Zend Framework, CakePHP and CodeIgniter. I also tried Joomla! before, learn about the Joomla framework, but, it is really troublesome. In my opinion, Joomla! is user friendly, but not developer friendly.

I tried CakePHP. It is better than Joomla, for a developer. But the Acl control provided is really difficult to learn. The “Bake” seems useful, but editing the generated files is also a pain. The MySQL database is also not highly customizable. I totally agree to a post in Stack Overflow:

Less automagic is a plus! 😉

That is why, I am currently using CodeIgniter. Comparing to CakePHP, I can freely to use and do anything I like. There are less rules to follow, only a very simple naming convention. I can add my own class to the MVC easily. The URL controller and method pattern is simpler. The pagination is also more customizable. The MySQL database allows me to use my own query. The MVC architecture with the database has much more freedom. So, CodeIgniter is my first choice.

For the JavaScript, there is jQuery, dojo toolkit, MooTools, Prototype JavaScript Framework, etc. In my opinion, these frameworks are similar. I used MooTools once, not very suitable for me. I personally prefer jQuery. But at the same time, I don’t like the websites which use jQuery, because I can hardly use Greasemonkey modify the functionaliy.

There are also CSS frameworks: 960 Grid System and Blueprint. These CSS frameworks use grid system for the web layout. My favourite is Blueprint. It is too good to make a usable website, because grid system makes the website more organised.

So, my web development frameworks = CodeIgniter + jQuery + Blueprint.

Joomla : CakePHP = Windows : Linux GCC


The followings are only my personal opinions.

Joomla!, a very popular CMS (Content Management System). Easy to use, a lot of extensions, free to download. Yet, not all the extensions are free. Some are commercial extensions. Some commercial extensions allow you to download for limited days of trial. Easy to install, easy to use. A lot of people like it.

On the other hand, CakePHP, not a CMS but only a web application framework (I mentioned CakePHP in this post because this is the only web application framework I used, I haven’t tried about CodeIgniter or Ohloh). Comparing CakePHP with Joomla isn’t quite appropriate because they are not same category. But for me, both of them are PHP and used to develop websites.

When looking for the Joomla extensions, most of the great extensions are commercial. Just like when I am search Windows software, a lot of software are commercial. However, CakePHP allows me to write my own applications. It is more developer friendly, freedom of programming. It is easy for me to write application using CakePHP rather than using Joomla API framework to write applications. Just like using GCC to compile the source code is easier than using Microsoft Visual C++ to compile the source code.

Therefore, in the sense of content management, Joomla is more appropriate than CakePHP. Though using CakePHP can produce something like Croogo, CakePHP itself is only a web application framework. However, using CakePHP can also produce CMS.