
Sorry man. I just can’t help myself XD This awesome wallpaper is done by Bik2007.
The picture above doesn’t relate to what I going to talk about but it’s a funny photo to start the ball rolling. My last project was Cosbase which you can read about it here. It’s a small project of mine that me and my partner in crime have undertaken to develop a cosplay gallery site. In hope that one day it will be something big in the future. A guy can dream.. right? So, after weeks of doing it I have found out some valuable advise that I think new developers might profit from. Cheers!
1] Error printing
One of the biggest problem facing young web developer is they don’t know why their application failed and have no idea where the problem lies. This can make many and sometime even me goes mad. So, learn to structure and print out appropriate error responses when you are handling your if-else tree. Other than that make sure you print out the variables that your function/script is currently using to see what is stored inside. This will tremendously help solving your problem with the knowledge of what is causing it.
Since I code in PHP and also use Javascript in my projects. I will share with you some commands you should burn into your brain for de-bugging purposes.
PHP
- Print_r() is a great frunction to print a human readable array.
- Echo/Print is great for printing out a variable.
Javascript
- Alert() – Great for prompting out any variable or message you put into it.
- Console.log() same as alert() however you can only see it in your developer console/firebug on your browser.
2] Don’t re-invent the wheel
If you’re trying to solve a problem on your project. For example, you want to write a small js script to validate user input in some of your forms. Sure. You can definitely create them however you are also wasting one of the most important resource that cannot be redeem when lost. Time. Yup, it’s valid and valuable in all fields.
For the example above I would recommend you look into bvalidator. This nifty little JQuery can easily help you do all the front-end validation without a sweat and would save you a lots of time de-bugging your own script if you build one youself. Not to mention implementation is quite easy too.
Take home advice is: Go google it before you re-invent the wheel unless it’s necessary.
3] Read the documentation
Usually scripts and frameworks provided by others have good documentation ready for you to check them out. So, make sure you read them while using their script or frameworks before you do any implementation as it will save you lots of time later on. Who knows that some of their scripts or functions can interfere with your project functions/variables as well? Check them!
4] Have a good logical mind
After some time coding in college I found out that having a good logical mind does pay off. Things in a system environment are usually defined and are structured. So, you just need to follow the pattern that is laid before you. For instance, you must imagine how a variable will travel through your system and what kind of functions they need to go through then what kind of output will be at the end.
This is a pre requisite if you are going to building advance functions in the future. And if you have mastered the “flow” it will dramatically increase your overall productivity and efficiency while writing codes.
5] Know your shit!
At least a basic understanding is needed when you are building up a dynamic website. For instance, you must at bare minimum understand HTML, CSS, Javascript, PHP and Mysql. It’s best that you are well verse in these technologies so it will be a breeze even when you hit a snag. Trust me. You don’t like snag that is impeding your progress. If you do I would recommend you to go visit http://stackoverflow.com/ they are a lots of people there who are willing to help and you might even find your answer there too.
On another note, knowing what functions and features exists for the technologies that you are using will be a life saver. For example: -
