Monday, September 21, 2015

Basic MVC Architecture

Hello people, In this post I would like to give a basic introduction to what is MVC architecture is, If you are starting to do a project using codeIgniter, you should have to have an idea about this architecture. Most people fail in early parts as they don't have a proper knowledge in this architecture. 


Why MVC?



 MVC stands for Model, View, Controller. It is a programing pattern used in developing
web apps. This pattern isolates the user interface and backend (i.e. database interaction from each other. A successful implementation of this lets developers modify their user interface or backend with out affecting the other. MVC also increases the flexibly of an app by being able to resuse models or views over again). 


Below is a description of MVC in nutshell.

The Model


The lowest level of the pattern which is responsible for maintaining data.The model deals with the raw data and database interaction and will contain functions like adding records to a database or selecting specific database records. In CI the model component is not required and can be included in the controller.


The View 


This is responsible for displaying all or a portion of the data to the user.The view deals with displaying the data and interface controls to the user with. In CI the view could be a web page, ajax data or any other "page". 

The Controller


Software Code that controls the interactions between the Model and View.The controller acts as the in between of view and model and, as the name suggests, it controls what is sent to the view from the model. In CI, the controller is also the place to load libraries and helpers.



An example of a MVC approach would be for a contact form.

  1. The user interacts with the view by filling in a form and submitting it.
  2. The controller receives the POST data from the form, the controller sends this data to the model
    which updates in the database.
  3. The model then sends the result of the database to the controller.
  4. This result is updated in the view and displayed to the user. 
 So guys that's it for this post. Hope you got an idea about MVC architecture an hoe it works.

Tuesday, September 15, 2015

Installing CodeIgniter

 Hello everyone, In this post I'll tell you how to begin a project using CodeIgniter. For our CP project we used Codeigniter as our framework.

There are many PHP frameworks available, such as CodeIgniter, Laravel, CakePHP, Zend, Fusebox etc. Different frameworks support different architectures. For example, Laravel and CodeIgniter support MVC (Model, View, Controller) architecture.   

Why We Choose CodeIgniter

 

CodeIgniter is a very light, well performing framework. While, it is perfect for a beginner, as we got a small learning curve, it's also perfect for large and demanding web applications. CodeIgniter is developed by EllisLab and has thorough, easy to understand documentation.

In this post I'll tell you how we start using CodeIgniter to our project.

Step 1 - Downloading CodeIgniter 

Too start off you will need to download CodeIgniter from http://www.codeigniter.com/ 

 upload it to your server. Use the path C:\wamp\www

In our project we used wamp server. Extract the downloaded file and create a folder in www using your project name and copy the extracted items to the folder. As our project is a Hotel reservation system we named the project folder as "hrs".

Once you have unzip the downloaded file you can see several set of folders.

inside application folder



  • The system folder stores all the files which make CI work. 
  • The config folder stores all the config files relevant to the application. Which
    includes information on what libaries the application should auto load and database details.
  • The controllers folder stores all the controllers for the application.
  • The errors folder stores all the template error pages for the application. When
    an error occurs the error page is generated from one of these templates.
  • The helpers folder stores all the helpers which are specific to your application.
  • The hooks folder is for hooks which modify the functioning of CI's core files,
    hooks should only be used by advanced users of CI
  • The language folder stores lines of text which can be loaded through the language
    library to create multilingual sites.
  • The libraries folder stores all the libraries which are specific to your application.
  • The models folder stores all the models for the application.
  • The views folder stores all the views for the application. 
  • The user_guide houses the user guide to CI.
  • The index.php file is the bit that does all the CI magic it also lets the you change the
    name of the system and application folders.

Step 2 - Configuring CodeIgniter

Getting CI up and running is rather simple. Most of it requires you to edit a few configuration
files. You need to setup CI to point to the right base URL of the app. To do this, open up system/application/config/config.php and edit the base_url array item to point to your server and CI folder.


Database Connection.


To connect a database with your project go to,

 application /config/database.php


Inside database.php you have to change the following according to your database configurations.




 Step 3 - Testing CodeIgniter


To see whether your CI is running properly, Go to http://localhost/hrs/ and you
should see the following.






For more information you can visit the user guide website http://www.codeigniter.com/user_guide/.It's simple and easy to understand.

and that's all for this post see you all soon.

Monday, August 31, 2015

An Experience Report -[Things not to do when working with a group]

Hello everyone in this article I will point out what will not to do working in SLIIT group projects

 1) Wait Until the last minute


Waiting until the last minute to start or finish your work is one of the dumbest things to do! Not only you will end up unable to complete your work, you will also be regretting the fact that you could've done better if you started early. Finish your work as soon as you can!

2) Just Think  about Yourself


Never be selfish! The rest of the group's happiness should matter to you as much as yours. Work together as a team and help each other. What you do today can improve your tomorrows. Project not only tests your coding skills, it tests your ability to work as a team.
 

These are some of the important things I learned. I guess it will be important to you as well. In my next article I will be explaining some technical things I've done for my project.

Saturday, July 18, 2015

How to Success in Group Projects



Team Collaboration




There are many factors to consider when collaborating in an agile project. and all who are involved need to understand their responsibilities, appreciate others, and keep a good communication with the group members, client and the supervisor.
Entire team should collaborate with one another to deliver the product on time.

Help Each Other


Helping each other is a key factor that you have to consider when doing an group project. As this is a group project all the functions of every member should work properly to consider it as a good product. This will also help you to develop your own knowledge.

Make Your Own Deadlines


After deciding what to do in the each iteration. You should be able to make your own deadline what should be completed in following weeks. This is not the only subject that you do, there are other subjects too. When coming to 3rd year the assignments of the other subjects become tougher. When doing it for the first time you'll be stressed out but eventually you'll get along with it.

See you again in next post. =)