10 Tips Beginner Web Developer Should Know

10_Tips_Beginner_Web_Developer

It is not a secret that PHP is the most popular programming language for server-side web development. The simplicity of this language attracts a lot of newbies. They read books about development, visit forums in order to upgrade their skills, but it does not lead to great results. Very often these newbies just take the first comer project and create something that need future rework. After such development it is rather to do all over again than to maintain an already existing code. So-called developers take money from customers and fail in trust. Due to their inexperience they just undermine freelancer’s authority.

If you want to become an expert in development, it is necessary to gain experience in many thematic projects, because many things come only in practice.

Developers Should Know

We would like to give some advices on how to write the code.

Learn the language

Sometimes, when programmers want to develop web-resources’ server-side scripts using the PHP C-like syntax, they write code based on their experience in C C + + Java programming languages.

The most common one:

function doSomething() { $query = mysql_query(“select …”); while ($result = mysql_fetch_row($query)) { $a[] = $result->key; } … unset($a); }

PHP unloads variables at the end of a script / function from the memory, that’s why the array’s removal is unnecessary action.

Do not use the old language constructs

PHP language changes all the time. There are a lot of new designs and options that can improve functioning of your applications. The language developers filter old, slow and ineffective. So do not forget to follow the innovations.

Do not reinvent the wheel

If you have a problem firstly you should check up if anyone had already faced and probably corrected it before.

You have to be fore-thoughtful

You must always verify the authenticity of the data entered from the client. First of all you should remove HTML, clean quotes, slashes, convert to the number etc.

Write a universal code

When you face a task that can be used in this project or another project in the future, it is reasonable to factor out it to a separate function, or even to a separate module (do not forget about the advice in paragraph 3).

Do not make the code more complicated

The code which has been written before must be simple and understandable to others.

Wrong way of writing code:

function doSomething($id, $param) { $sql = “select… whre id=$id limit 1;”; $query = mysql_query($sql); if($query) { $result = mysql_fetch_assoc($qr); if ($result[‘key’] == $param) { return true; } else { return false; } } else return false; }

The right example:

{ $sql = “select… whre id=$id limit 1;”; if (($query = mysql_query($sql))== false) return false; if( $result = mysql_fetch_assoc($query) { return $result[‘key’] == $param; } else return false; }

Do not forget to leave your comments

Well everything is simple, you should comment on the important moments of the code, make out the comments to the classes, properties, methods, and functions, preferably in PHPDoc.

Do not forget about the Object-oriented programming

PHP 5 is an OOP language, so when you are designing a project, do not forget about it. The class hierarchy allows not only extending the code, but also to make easier the using of already written code for other projects.

Learn software patterns

Software patterns are the separate broad topic, which allows you to understand the principles of OOP programming and to avoid errors in design.

Do not use PHP when you can use SQL

SQL queries are executed at the driver level and work in times faster than PHP. For example, if you want to find out the number of records you can use SQL function COUNT.

These were the core things you should know about development process. If you want to become an expert you should pay more attention to small details. We wish you success in training and project development.

Author Detail : The article was written by the PR and Marketing Manager of QArea Company. Visit Website: http://www.qarea.com / Facebok: https://www.facebook.com/qarea.inc

One comment

  1. Dino Adderly says:

    Very well written story. It will be useful to anybody who employess it, including myself. Keep doing what you are doing – looking forward to more posts.

Leave a Reply