My adds on – “Just PHP will give you nothing… unless you upgrade yourself”

Recently i was reading an article from Hasin bhai,
which is titled “Just PHP will give you nothing, unless you upgrade yourself”
here is my comment on hasin bhai’s post

wow hasin bhai, nice write up.
Bro i wanna add up few topics which are leaking in most of the php developers. i belief most of the PHP developers are producing dirty fast code (not 30th first night ;)) it is because of the following reasons:
(my suggestion are enclosed with in ‘–>’ context)

1. less concentration of DRY (Don’t Repeat Yourself)
–> Create each fragment as reusable module (for example: latest_comments.php, latest_user.php, latest_news.php etc..)

2. Search those code which u have written more than once
–> Separate them. (keep them in separate reusable file)

3. Keep your business logic away from presentation layer
–> you don’t need to follow any strict design pattern like MVC, MVP. just plain solution is enough. Use php class to manage your business rules.

4. Use any good framework, it doesn’t mean you have to use java or Ruby on rails like framework. Better go for simple and productive framework.

5. Use library from trusted parties (hope zend is growing up its huge libraries on many aspect), PEAR is obviously great choice.

6. Don’t think all running web application is 100% accurate, and never ever grab their design and code. Better use your own sense and create a colorful stuff… meet your own client requirements.

7. Don’t mix up PHP with java or these kinda technologies
–> The way php works and the way Java works are not same, and better not compare both. Never ever try to implement all design patterns which are successful on Java EE platform. PHP is great for its simplicity. Java is great for its complexity.

8. Go for better object orientation, but it doesn’t mean you have to restrict everything with in a bunch of classes.
–> PHP is not intended to develop for this purpose. Rather follow php related performance tuning stuff.

9. Always keep your data access layer separate from raw or presentational php coding

10. Always go through open source projects, where you can learn how big projects are managed by human beings.

My few suggestions:
1. Keep a separate file for all SQL queries. for example:
(#) file: sql_index.php
$select_users = ‘select * from User’;
$delete_user_by_id = ‘delete from User where userID=?’;

$select_comments = ‘select * from Comment’;
$delete_comments = ‘delete from Comment’;

(#) file: sample_usages.php
$result = mysql_query( $select_user);

—> Benefit is, when you want to solve cross database related issue, you can resolve it very frequently (though you can write Data Abstraction Layer dependent code)

2. Presentational files (which files are used to render web UI) should keep their logic through few helper functions (rather hard embedded code). For example:
(#) File: test.php

title ? >

(#) File: replace_test.php

3. Limit frequent database access.
–> Go for caching system, use PEAR cache or any cache solution from PECL. For more optimized and challenging solution go for DSO related caching solution, whenever you will need multiple server It will give you a big hug. Go for MemCache, as it has been proven for several years.

4. Grow your knowledge on Software engineering.

5. Explore your idea, you can become a good developer but you can’t become a good idea creator unless you explore and dive inside the deep sea of knowledge.

6. Travel as much place as you like, it will help you to grow up a good sense of creativity. (I have to start it … 😀 )

7. Don’t forget to adopt little stuff from TDD (Test driven development), dig these terms: unit test, fixture etc…

8. Try to work on agile team. Enforce your PM to learn about agile related stuff. Select the best agile methodologies which are most suitable for your company. (Agile comes with a bunch of options, scrum, XP, rup and many stuff)

9. While you writing your code, always think, your code will be verified by some guy, who is very strict and who will surly scream because of your poor writing… :p (anyway, if u feel your code is nice … just send me. during my week ends I will check it up… obviously I will come with a set of good criticize 🙂 )

10. Learn, Dig, Seek and Dive in “KnowSea”

11. Use change management tools, (Subversion, bug tracking system and project planning tools)

(hasin bhai apologized for Big comment :p)

Best regards,


7 responses to “My adds on – “Just PHP will give you nothing… unless you upgrade yourself”

  1. wow great stuff hasan…go on…

  2. Nur Sarowar

    Hasan to understand your advice (Or Hasin bruvz) Bangladeshi programmer need to minimum amount of know knowledge.

    My question is do they have that knowledge? Actually the world is still too big place for most of them and they even do not have a clue where they are standing right now.

    If you are advising to use %u201CFramework%u201D %u201CTemplate Engine%u201D %u201CDAO%u201D. But you might be surprise to know most of programmer dose not have a clue what these things do. Yes, You heard me right; they even do not know what is framework. Wired isn%u2019t it?

    If we keep saying negative stuff the list will never end.

    The question is what we are doing to help them? In my office I gave chance to those programmer who even dose not know what is PHP and help to improve your skill and knowledge. I even taught them how to use search engine and find solutions. When they learn few things they get offer from another place with one-thousand taka salary difference and they jump there. So what%u2019s point to spend so much time to them? They learned very basic things about web and PHP before they jump, if they continued they could have learn lots of things what might give them a chance to improve.

    Long story short, as long as we are not loyal to ourselves we will not do good in anything. People in BD even cheat themselves about their skill. FUNNY

    Side Note: What%u2019s up with your blog comments posting date and time?

  3. Hi “Sarowar” bhai,
    thank you for your nice comment. yeap you are right. people are cheating themselves. Job satisfaction is the most important topic. when ppl are not satisfied with their job and environment they suppose to move on new company..
    in bd ppl move for slightest salary improvement, thats really sad. when we find any CV, first we checkout their skill and consistency of their previous working environment. those who are constantly moving their job. it is really killing their future job chance too..
    anyway, we need self motivated people, we can’t push those people who won’t help himself…
    best regards,

  4. ooh Sarowar bhai,
    yeap my comment timestamp is wrong.

  5. Pingback: » Blog Archive » My adds on - “Just PHP will give you nothing… unless you upgrade yourself”

  6. Hasan thank you kindly for your comments and congratulations on your intelligent blog.

  7. skywriter14

    @Nur Sarowar:
    The world would be really grateful if you mention the salary you are talking about!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

my tweets

January 2007
« Dec   Feb »

Flickr Photos

RSS my shared links on google reader

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: