February 23, 2010

It is often tempting to skip unit testing for ad-hoc testing. However when done in the appropriate amount unit testing will increase productivity and reliability. It is also a great diagnostic tool. Unit testing is a skill that can get you to the next level as a programmer as well as an organization. It takes discipline and when done in the right amount you should be able to reap the benefits in weeks.

In this article, I will show simple examples on how to move your ad-hoc tests to test classes. The examples use the RawDev framework which makes unit testing as easy as it can possibly be. I will cover what a unit test is, how to create tests and a tool to execute the tests. I will also talk about some of the pitfalls and how to get around them.

What is a unit test?

Since virtually all code resides in functions, RawDev uses the following definition:

RawDev defines a unit test as a single test of the output of a function call, given specific input. Part of a test is also the verification of object and global state changes.

The above diagram shows all the relationships to a function that is unit tested. The terms in the diagram are described below:

unit-testing

Continue reading "It Is Not Whether You Should Unit Test But How Much" »

February 23, 2010

Fat-Free is a modular and lightweight PHP 5.3+ Web application framework designed to help build dynamic and robust Web sites. It shows some resemblance to Ruby's Sinatra and PHP's Limonade, but the similarities end with Fat-Free's HTML/XML/RSS/e-mail template rendering engine, CAPTCHA image generator, an SQL database helper, etc. which allow development teams to distribute work loads and compartmentalize programming/design efforts in typical MVC fashion.

fatfree php framework

The sofware has two separate yet tightly-linked modules:

  • The Core Pack, which provides the base framework functionality and access to Fat-Free's fast template engine, powerful cache, HTML forms processor, and easy-to-use SQL handler for databases - in one tiny zero-install file!
  • The optional Expansion Pack, which works seamlessly with the Core Pack, includes a CAPTCHA image generator, Javascript/CSS compressor, and a thumbnail image generator.

More information and download at fatfree.sourceforge.net. Released under GPL v3 license.

February 18, 2010

If I have to describe Fabien Potencier, I'll describe him as a Web Composer or a PHP Artist for writing a very beautiful composition played by a large orchestra of PHP developers around the world. Symfony 2 have just been revealed to public with a new innovative architecture, "Symfony 2 is fast, flexible, and easy to learn. It allows developers to built better and easy to maintain websites with PHP". New in Symfony 2 :

  • High Performance : Symfony 2 is up to 3 times faster than symfony 1.4 or Zend Framework 1.10 and consumes half the memory
  • Extensible : Symfony 2 is built from the ground up around "bundles" (plugins in Symfony speak). Bundles are first-class citizens, and the core framework itself is made of bundles.
  • Flexible : Thanks to an innovative micro-kernel based on a Dependency Injection Container and an Event Dispatcher, Symfony is configurable at will.
  • Built for Developers : Symfony 2 provides tools that greatly enhance the productivity of developers, like the famous web debug toolbar, native support for environments, detailed error pages, and more.
  • Full-Featured : Symfony 2 comes out of the box with all the features you need to develop modern web applications. It also provides built-in security and promotes web development best practices.
  • Open-Source : Released under the MIT license

The presentation below give a good insight of new features and changes in Symfony 2 :

The preview release of Symfony 2 is not yet ready for production. The final release is planned for late 2010 and will only supports PHP 5.3. In the meantime, the current stable release for all your projects is symfony 1.4. More information and download at http://symfony-reloaded.org/

August 24, 2009

DooPHP 1.1 have just been released with a more complete and mature list of features, in addition to performance improvements, again ! The benchmark comparison of v1.0 and v1.1 show a slightly high number of Requests Per Second (RPS) supported by v1.1 compared to 1.0, In addition to a new benchmark showing the new frontend cache mechanism performance with a database connection.

doophp1.1_benchmark

Noticeable New Features in v1.1 :

  • Access Control List(ACL) as built-in authentication support.
  • Data caching which supports APC, Memcache, XCache, EAccelerator & file based cache.
  • Sophisticated Frontend cache mechanism where both full page(single/recurvise) & partial page cache are supported.
  • Database replication (master-slave) support in the ORM tools
  • Better conventional modular directory structure support.
  • Auto loading of the framework classes.
  • IF statement and Cache tag support for template engine.
  • Enhanced model class generator. PostgreSQL supported.
  • Image manipulation helper for resize, crop, watermark, upload, etc.
  • Pager component for item list pagination.
  • Text helper class for string manipulation.
  • Url builder class to generates URLs based on route ID or controller & method names
  • Log/Profile viewer tool.
  • Sitemap Generator tool to generate routes and controller files.

Download latest DooPHP. New demos and tools are added in to help you get started with the Framework. There are already some mentions of DooPHP in our PHP Frameworks Trends, so if you are on twitter you can voice your opinion or share your experience with DooPHP.

August 19, 2009

P4A, PHP for Applications, is an interesting PHP5 RAD and object oriented PHP framework to build event-driven stateful web applications. P4A is based on Zend Framework 1.5 and using jQuery, jQuery UI, and FCKEditor to provides developers with a complete RAD solution that features tableless HTML, multiple databases, accesskey support, auto data type recognition, transparent AJAX, UTF-8, i18n/l10n.

P4A

P4A project started since February 2003 and was finalist in the SourceForge 2006 Community Choice Awards. The project is 100% written in PHP5 and is compatible with PHP 5.2.x, Apache 1.3.x/2.0.x and Microsoft IIS 6.0 web servers on Linux/Unix/Windows operating systems. One of the most useful feature is its widget system which is like the visual components found on desktop development tool such as, Delphi, Visual C, Netbeans, etc. Many widgets are available including single line or multiple lines text fields with advanced rich WYSIWYG text editing support, checkboxes, single/multiple selection fields, tables, buttons, tree navigators, toolbars, fieldsets etc...

P4A includes a nice and clean graphical theme that you can easily customize with color schemes, icons packs, additional CSS. If you use, like or suggest P4A Framework be sure to mention it (as p4a) in our PHP Frameworks Trends.

August 15, 2009

We announced last month Limonade PHP microframework. Today here come Tekuna, an MVC Microframework for PHP. Tekuna is small, just 3000 source lines of code, it improves reusability with a component-oriented definition of the application and intuitive routing. Its small footprint will not pollute your codebase with unnecessary stuff.

Tekuna

Below a more detailed features list for Tekuna :

  • Component-oriented Definition of the Application
  • Intuitive Routing of Actions to Controllers
  • Friendly URLs (RESTful API)
  • MVC Architecture
  • PHP Error handling with Exceptions (and thus catchable)
  • Separate Request and Response Objects
  • Strict Input Filtering
  • Full UTF-8 Support
  • Support for multiple Template Engines
  • Simple Multilanguage Support
  • Fully Unit-tested
  • 100% E_STRICT Compliant
  • Combinable with many other frameworks (Templating, ORM, Unit-testing...)
  • Geared to java programming and naming style
  • Open Source under an MIT License

Current Tekuna version os 0.1.189 requires PHP 5.2.1 with mod_rewrite enabled on your Apache webserver. A quick start is available to understand Tekuna principles, architecture and features. The project is at its early stage and not ready for production, but you might check the project's roadmap to have a better idea about what's coming next.