PHP to conform W3C Standards
Posted on Thursday, May 3rd, 2007
Under: General, PHP | 2 Comments »
Posted on Thursday, May 3rd, 2007
Under: General, PHP | 2 Comments »
A Jordanian start-up is looking for 5 really smart programming junkies, or wannabies
Experience or fresh doesn’t matter, just shoot me your CV.
Jad [ at ] syntux [ d o t ] n et
Tags: jordan middle east, smart programming, php programmers, just shoot me, jad, junkies, cv
Posted on Wednesday, February 28th, 2007
Under: PHP | No Comments »
Perhaps no other coding practice is as important as testing your code. Also in the nature of Business Development, where parts of your code always change on the request of a client (including Management), or even when you want to make your code run with better performance, Automated tests are highly needed, you can’t just spread your print statements all over your code every time you need to test it.
With automated tests, you can just be sure that your interface is not broken after some change, you just run your tests, if they succeed, you know that you didn’t break your code (this means you should right good tests).
Let’s start by a simple example, Imagine that we have been asked to test PHP’s built-in Array. One bit of functionality to test is the function sizeof(). For a newly created array we expect the sizeof() function to return 0. After we add an element, sizeof() should return 1. (I know it’s not a big deal, but it’s just an example).
you can do it with simple print statements (i.e. print (1 == sizeof($myArray) ? "OK":"Failure").PHP_EOL; ), but here we are going to do it by using an assertion function.
Well, we could know if something went wrong if some Exception was raised, of course assertTrue is not the only thing you want to do, UnitTesting has gone far beyond that, usually UnitTesting frameworks provide a whole lot of features that you need for your testing.
Lot’s of Testing frameworks are available for PHP, I’m going to point to 2 of them, the first one is SimpleTest (http://simpletest.org/), it’s written in PHP 4 (Although they are going to migrate to PHP 5 when they reach version 2), so you can use it on both PHP 4 and 5 programs, also it includes a nice HTML reporter for some good looking html results the same test above could be written using this framework as:
Another Well know testing framework is known as PHPUnit2 (http://www.phpunit.de/), it’s available through the PEAR Repository, you can install it as
$ pear install PHPUnit2
It’s written in PHP 5, and is so widely used within PHP Developers, a good resource for learning how to use it is the free available online book PHPUnit Pocket Guide (http://www.phpunit.de/pocket_guide/index.en.php), the same example could be:
and you can run it on command line as
$ phpunit ArrayTest
Additional benefits that you can realize by thoroughly testing your code:
Finally, if your test suite - your set of test cases - is very thorough, you can say your code is complete when all of your test pass. Interestingly, that notion is one of the hallmarks of Test Driven Development.
Test Driven Development (TDD), also referred to as Test First Coding, is a methodology that takes testing one step further: you write your tests before you ever write any code. A nice, brief summary of the tenants of TDD is available at http://xprogramming.com/xpmag/testFirstGuidelines.htm, and a good introductory book on the strategy is “Test Driven Development: By Example” by Kent Beck. (The book’s examples are in Java, but it’s a quick read and gives you a very good overview and introduction to the subject.)
Agile Development
Recently, unit testing - in particular Test Driven Development - has been associated with agile Development methodologies such as Extreme Programming (XP)g that focus on rapid iterations of releasing functional code to customers and welcoming changing customer requirements as a natural part of the development process. Some good online resources for learning about agile development include:
Tags: automated tests, sizeof, business development, array, functionality, element, nature of business, interface
Posted on Tuesday, December 12th, 2006
Under: Code, HowTo, PHP | 8 Comments »
The path of the righteous coder is beset on all sides by the iniquities of the selfish and the tyranny of evil Ruby Users. Blessed is he, who in the name of PHP and good code, shepherds the weak through the valley of Rails, for he is truly his brother’s keeper and the finder of lost Syntuxes. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison a and destroy my brothers.
Tags: ruby users, furious anger, iniquities, vengeance, tyranny, brother
Auto Loan Quotes save money on your auto loans
Posted on Monday, November 20th, 2006
Under: General, PHP | No Comments »
In 2005 we had great discount from Zend for the PHP4 exam voucher, guide and practice book, This year, couple of months ago we at JoPHP (Jordan PHP Users Group) for PHP5 Exam festival, we had plan to do one week exam preparation session and then twenty five of us was motivated to take the exam.
Many things slowed down the plan and killed the motive and I guess you are safe to put it on me and blame me for that; Hope we will be able to prepare for another event later in 2007.
But anyway we always have B plan and here is the deal
zcej100 discount code to get $25 off your order. Big thanks for Zend for their generous offer and hope we can make better plan for such event next year.
Wish you the best.
Tags: php users, zend, voucher, users group, many things, motive, jordan, certification exam, certification guide, exam preparation, guide practice
Posted on Friday, November 17th, 2006
Under: Community, PHP, Zend | 5 Comments »