How Thinking and Developing Modular Can Increase Productivity

Jul 28
2010

When we have one few too many clients, we panic and begin to cut corners to squeeze in as many clients as we can into our schedule, and we end up working nights and weekends with buggy results. What if there is a way to save time and still manage the same amount of clients if not more?

Creating modular components is a step closer to reaching that goal, you can have 10, 20, 30, or even 40% if not more complete already with just several minutes of piece work.

How Does Developing With Modularity in Mind Work?

Developing with modularity in mind means everything that you can develop that can work on its own without the requirement of being laced with its parent to function properly. For example, let us say a client needs a content management system developed in PHP. Off the top, we already know we will need to develop a pagination system, a MySQL Class, and a template system.

An advanced pagination system can take few hours to perfect, a good well equipped MySQL class can take an hour or two, and a full-fledged template system can take several hours if not a few days to get it right. However, if these components are developed to be modular, you will only spend the time developing them once, and only several minutes integrating them into any other project, saving you hours and days of work.

To provide a real world example; a recent client I had needed a system that displays his inventory from his database. I quickly grabbed my already developed pagination class and MySQL class, restructured the provided MySQL tables, and retrieved the inventory paginated. The entire project took me thirty minutes to complete where it would have taken me several hours to complete if I had to start from scratch.

Therefore, spending the time to develop quality modular components increases your productivity and saves you time. Additionally, reinventing the “wheel” is always an action unnecessary and unneeded, thus being able to copy and paste modular components into many of your projects is a lifesaver.

How to Develop Modular Components

Developing modular components is all about the structural design, keeping it unattached to a specific project you are developing. The first step in creating a modular component is to think modular. Let us look at glue, it is a substance that mends and works on many items you need it for, however, it does not need your items to properly function as it functions alone. This is exactly how modularity works and the way these components should be developed.

In order to help grip this concept better, we will do a run down on a modular component as well as have it available for download free at the end of this article to have a go at it yourself.

The modular component we will be looking at is an advanced PHP MySQL Class, which makes connecting to a database and running queries easy. Let’s look at the constructor of this class:


    function __construct($db_host, $db_user, $db_pass, $db_name, $db_prefix)
    {
       //define 'em all!
       $this->host   = $db_host;
       $this->user   = $db_user;
       $this->pass   = $db_pass;
       $this->name   = $db_name;
       $this->prefix = $db_prefix;
    }
            

The constructor in this case gathers all the necessary information so that the methods of this class properly function.
Therefore, allowing the component to work seamlessly with your project while keeping the component separate and modular.

In order to understand how this class works, we will look at a couple of its methods starting with the connect method.


    protected function connect()
    {
       $this->db = mysql_connect($this->host, $this->user, $this->pass) or die(mysql_error()."".$this->db);
           //check if we have connected, otherwise run this function again

       if(!$this->db)
    {
       $this->connect();
                    }

         //since we're connected, let's select the db
            else
    {
       $this->db = mysql_select_db($this->name, $this->db) or die(mysql_error()."".$this->db);
           return $this->db;
                    }
                }
            

As shown above, the connect method is a protected method that creates a connection with MySQL and selects the database. The reason it is inaccessible outside of this class is that this method runs automatically by other methods within the class; hence, you do not need to call it. Another method we will look at is the select method, which builds a select query based on the information you provide via its parameters:


    public function select($table, $fields="*", $conditions=0, $options=array())
    {
           //check if we have a db connection
      if(!$this->db)
    {
      $this->connect();
                    }

    $query = "SELECT ".$fields." FROM ".$this->db_prefix.$table."";
       if($conditions !=0)
     {
    $query .= " WHERE ".$conditions;
                    }    

       if(isset($options['order_by']))
     {

     $query .= " ORDER BY ".$options['order_by']."";
       if(isset($options['order_dir']))

      {
     $query .= " ".strtoupper($options['order_dir']);
                        }
                    }
        if(isset($options['limit_start']) && isset($options['limit']))
      {
     $query .= " LIMIT".$options['limit_start'].",".$options['limit'];
                    }

        elseif(isset($options['limit']))
      {
     $query .= " LIMIT ".$options['limit'];
                    }

        if(!$this->db)
      {
     $this->connect();
                    }

       return $this->query($query);
                }

While it may seem to be easier to build the query yourself, this method retains the integrity of your system and keeps your projects tidy, and as a bonus, it makes creating queries for your client a lot easier when they modify their script. Additionally, integrating security measures within these methods means that those security measures will be applied to all the queries you run, good for filling in the gaps that you may have missed.

Download the MySQL Class

This MySQL Class is for demonstration and learning purposes only. Click to Download.

44 Stunning HD Wallpapers Pack

Jul 28
2010


hd wallpapers

Another great pack of HD wallpapers, compiled in a single zip file you will find 44 high resolution HD wallpapers 1920 x 1200.

You can check the wallpapers category for more free wallpapers.

Remember to follow @Garcya on twitter or subscribe to the feed for free if you haven’t done that yet.

You can also visit us on Facebook for extra insights.

Also, I am not going to force you, but if you want to hit that Digg badge, Re-Tweet or share where you want, I’ll love you forever and ever!

free wallpaper

42 140x140 vector 44 Stunning HD Wallpapers Pack 38 140x140 vector 44 Stunning HD Wallpapers Pack 19 140x140 vector 44 Stunning HD Wallpapers Pack 17 140x140 vector 44 Stunning HD Wallpapers Pack 111 140x140 vector 44 Stunning HD Wallpapers Pack 37 140x140 vector 44 Stunning HD Wallpapers Pack 22 140x140 vector 44 Stunning HD Wallpapers Pack 32 140x140 vector 44 Stunning HD Wallpapers Pack 02 140x140 vector 44 Stunning HD Wallpapers Pack 40 140x140 vector 44 Stunning HD Wallpapers Pack 25 140x140 vector 44 Stunning HD Wallpapers Pack 43 140x140 vector 44 Stunning HD Wallpapers Pack 09 140x140 vector 44 Stunning HD Wallpapers Pack BlueWater 151 140x140 vector 44 Stunning HD Wallpapers Pack 41 140x140 vector 44 Stunning HD Wallpapers Pack free wallpaper 04 140x140 vector 44 Stunning HD Wallpapers Pack 20 140x140 vector 44 Stunning HD Wallpapers Pack 30 140x140 vector 44 Stunning HD Wallpapers Pack 291 140x140 vector 44 Stunning HD Wallpapers Pack 131 140x140 vector 44 Stunning HD Wallpapers Pack 23 140x140 vector 44 Stunning HD Wallpapers Pack 21 140x140 vector 44 Stunning HD Wallpapers Pack 01 140x140 vector 44 Stunning HD Wallpapers Pack 35 140x140 vector 44 Stunning HD Wallpapers Pack 36 140x140 vector 44 Stunning HD Wallpapers Pack 06 140x140 vector 44 Stunning HD Wallpapers Pack 121 140x140 vector 44 Stunning HD Wallpapers Pack 03 140x140 vector 44 Stunning HD Wallpapers Pack 34 140x140 vector 44 Stunning HD Wallpapers Pack 16 140x140 vector 44 Stunning HD Wallpapers Pack 31 140x140 vector 44 Stunning HD Wallpapers Pack 18 140x140 vector 44 Stunning HD Wallpapers Pack 24 140x140 vector 44 Stunning HD Wallpapers Pack hd wallpapers 08 140x140 vector 44 Stunning HD Wallpapers Pack 33 140x140 vector 44 Stunning HD Wallpapers Pack 281 140x140 vector 44 Stunning HD Wallpapers Pack 39 140x140 vector 44 Stunning HD Wallpapers Pack 07 140x140 vector 44 Stunning HD Wallpapers Pack 05 140x140 vector 44 Stunning HD Wallpapers Pack 26 140x140 vector 44 Stunning HD Wallpapers Pack 27 140x140 vector 44 Stunning HD Wallpapers Pack 44 140x140 vector 44 Stunning HD Wallpapers Pack 101 140x140 vector 44 Stunning HD Wallpapers Pack

(...)
Read the rest of 44 Stunning HD Wallpapers Pack ( you won't regret it :-) )


Do you like what you see? Any help is welcome! It keeps me working and provide YOU with Free Vector Graphics. Thank you!



© Garcya for Web Design Blog, 2010. | Permalink | 5 comments
Post tags: ,

Illustrate the Apple iPad in 40 Minutes

Jul 28
2010


apple ipad

If you are a beginner in the design industry and want to practice and practice this is a great detailed tutorial to start with.

You are about to design the famous Apple iPad (I wish I had one :p ) and you’re going to do this with Adobe Illustrator.

Vector.Tutsplus.com is going to show you how to do it in about 40 minutes and not that much hassle.

Follow the tutorial right here!

Related posts:

  1. Comments not showing
  2. The most complete collection of apple vectors
  3. 22 Sites for Free Graphics Design Tutorials


Do you like what you see? Any help is welcome! It keeps me working and provide YOU with Free Vector Graphics. Thank you!



© Garcya for Web Design Blog, 2010. | Permalink | 2 comments
Post tags: ,
Digg del.icio.us Stumbleupon Technorati Reddit