CodeIgniter MVC – The Power of Simplicity!

Programming with CodeIgniter MVC

,
September 2013

$20.99

Build feature-rich web applications using the CodeIgniter MVC framework

(For more resources related to this topic, see here.)

"Simplicity Wins In Big!"

Back in the 80s there was a programming Language ADA that according to many contracts was required to be used. ADA was so complex and hard compared to C/C++ to maintain. Today ADA fades like Pascal.

C/C++ is the simplicity winner for real time systems arena.

In Telecom for network devices management protocols there were two standards in the 90s: CMIP (Common Management Information Protocol) and SNMP (Simple Network Management Protocol). Initially (90s) all telecom Requirement Papers required CMIP support. Eventually after several years a research found that there's about 1:10 or 10x effort to develop and maintain a same system based CMIP compared to SNMP.

SNMP is the simplicity winner in network management systems arena!

In VoIP or Media over IP, the H.323 and SIP (Session Initiation Protocol) were competing protocols in early 2000. H.323 had the messages in a cryptic binary way. SIP makes it all textual XML fashioned, easy to understand via text editor. Today almost all end point devices powered SIP while H.323 becomes a niche protocol for the VoIP backbone. SIP is the simplicity winner in VoIP arena!

Back in 2010 I was looking for a good PHP platform to develop Web Application for my startup 1st product Logodial Zappix (http://zappix.com).

I got a recommendation to use DRUPAL for this. I've tried the platform and found it very heavy to manipulate and change for my exact user interaction flow and experience I had in mind. Many times I had to compromise and the overhead of the platform was indeed horrible. Just make Hello world App and tons of irrelevant code will get into the project. Try to make free JavaScript and you found yourself struggling with the platform disabling you from the creativity of client side JavaScript and its Add-ons. I've decided to look for a better platform for my needs.

Later on I've heard about Zend Framework MVC (Model-View-Controller framework typed). I've tried to work with it as it is based MVC and a lot of OOP usage, but I've found it heavy... Documentation seems great at first sight, but the more I've used I, looking for vivid examples and explanations, I found myself in endless close circle loops of links.

It was lacking a clear explanation and vivid examples.

The filling was like every match box moving task, I'd required a semi-trailer of declarations and calls to handle making it... Though it was MVC typed which I greatly liked.

Keeping on with my search, I was looking for simple but powerful MVC based PHP which is my favorite language for server side.

One day in early 2011 I got a note from a friend that there's a light and cool platform named CodeIgniter (CI in brief). I've checked the documentation link http://ellislab.com/codeigniter/user-guide/ and was amazed from the very clean, simple, well organized and well explained browsing experience.

Having Examples? Yes, lots of clear examples, with great community. It was so great and simple. I felt like those platform designers were doing the best effort to make the simplest and most vivid code, reusable and clean OOP fashion from the infrastructure to the last function. I've tried making web app for a trail, trying to load helpers, libraries and use them and greatly loved the experience.

Fast forward, today I see a matured CodeIgniter as a Lego like playground that I know well. I've wrote tons of models, helpers, libraries, controllers and views. CodeIgniter Simplicity enables me to do things fast and, clear and well maintained and expandable. In time I've gathered the most useful helpers and libraries, Ajax server and Browser side solutions for reuse, good links to useful add on such as the free Grid Powered Plug-In for CI the http://www.grocerycrud.com/ that keep improving day by day.

Today I see Codeigniter as a matured scalable (See at&t and sprint Call Center Web apps based CI), reusability and simplicity champion.

The following is the high-level architecture of the Codeigniter MVC with the Controller/s as the hub the application session.

The CI controller main use cases are:

  • Handles requests from web browser as HTTP URI call, based on submitted parameters (for example Submitting a Login with the credentials) or with no-parameters (for example Home Page navigation).
  • Handles Asynchronous Ajax requests from the Web Client mostly as JSON HTTP POST request and response.
  • Serving CRON job requests that creates HTTP URI request, calling controller methods, similar to browser navigation, silently from the CRON PHP module.

The CI Views main features:

  • Rendered by a controller with optionally set of parameters (scalar, arrays, objects)
  • Has full open access to all the helpers, libraries, models as their rendering controller has.
  • Has the freedom to integrate any JavaScript / 3rd party Web Client side plug-ins.

The CI helper/s main features and fashion:

  • Flat functions sets protected from duplication risks
  • Can be loaded for use by any controller and accessed by any rendered view.
  • Can access any CI resource / library and others via the &get_instance() service.

The CI Libraries main features and fashion:

  • OOP classes that can expand other 3rd party classes (For example, see the example of the Google Map wrapper in the new Book).
  • Can access any of the CI resources of other libraries, built-in services via the &get_instance().
  • Can be used by the CI project controllers and all their rendered views.

The CI Model main features and fashion:

  • Similar to Libraries but has access to the default database, that can be expanded to multi databases and any other CI resource via the &get_instance().
  • OOP classes that can expand other 3rd party classes (For example, See the example of the Google Map wrapper in the new Book).
  • Can access any of the CI resources of other libraries, built-in services via the &get_instance().

It seems that CodeIgniter is continuously increasing its popularity as it has a simple yet high quality OOP core that enables great creativity, reusability, and code clarity naming conventions, which are easy to expand (user class extends CI class), while more third-party application plugins (packages of views and/or models and/or libraries and/or helpers).

I found Codeigniter flexible, great reusability enabler, having light infrastructure, enables developer creativity powered active global community.

For a day to day the CI code clarity, high performance capabilities, minimal controllable footprint (You decide what helpers/libraries/models to load for each controller).

Above all CI blessed with very fast learning curve of PHP developers and many blogs and community sites to share knowledge and raise and resolve issues and changes.

CodeIgniter is the simplicity winner I've found for Web Apps MVC Server side.

Summary

This article introduces the CodeIgniter framework, while initially getting started with web-based applications.

Resources for Article:


Further resources on this subject:


Books to Consider

comments powered by Disqus
X

An Introduction to 3D Printing

Explore the future of manufacturing and design  - read our guide to 3d printing for free