Federico Cargnelutti

Simple is better than complex. Complex is better than complicated. | @fedecarg

Archive for March 2007

The importance of User Experience

leave a comment »

user_experience.jpg

It’s all about the user, right? User experience, often abbreviated UX, is a term used to describe the overall experience and satisfaction a user has when using a product or system. It most commonly refers to a combination of software and business topics, such as selling over the web, but it applies to any result of interaction design. Interactive voice response systems, for instance, are a frequently mentioned design that can lead to a poor user experience.

The importance of User Experience

A usability poster like this one will look great in your office. At least your boss will think that you love users and that you have upgraded to version 2.0. You can buy this poster from here . And no, I’m not attaching any referral code to this link… yet ;)

Written by Federico

March 31, 2007 at 10:59 pm

Posted in Web

The observer pattern

with 2 comments

Loose coupling is critical to any large-scale project, but few people actually understand what the term really means. Have you ever made a small change in a project, and it seems that as a result, almost everything else has to change as well? This occurs all too often because of tight coupling among the modules in the program. Each module relies on the exact state or function of several other modules. When one fails, they all fail. When one changes, they all must change.

Read the rest of this entry »

Written by Federico

March 31, 2007 at 10:21 pm

Referential integrity

leave a comment »

Recent versions of MySQL have implemented support for foreign keys through the new InnoDB table engine. We explain how it works

Referential integrity is an important concept in database design. The term refers to a state when all the references in a database are valid and no invalid links exist between the various tables that make up the system. When referential integrity exists, any attempt to link to a record which does not already exist will fail; this helps prevent user errors, producing a more accurate (and useful) database.

Read the rest of this entry »

Written by Federico

March 30, 2007 at 11:50 pm

Posted in PHP

Database Error Handling

with one comment

One of the aspects that separate the great coders from the rookies is not just making usable or working code but taking care of unforeseen eventualities. When working with more than one process (PHP and MySQL), sometimes unforeseen incompatibilities or server hiccups can cause an unwanted problem. To ensure the integrity of your web applications, it is important that, if such a problem occurs, the web application dies gracefully and provides a means for the developer to track the error.

Read the rest of this entry »

Written by Federico

March 30, 2007 at 11:44 pm

Posted in Databases, PHP

Polymorphism

leave a comment »

The subject of polymorphism is probably the most important in OOP. Using classes and inheritance makes it easy to describe a real-life situation as opposed to just a collection of functions and data. They also make it much easier to grow projects by reusing code mainly via inheritance. Also, to write robust and extensible code, you usually want to have as few as possible flow-control statements (such as if() statements). Polymorphism answers all these needs and more.

Read the rest of this entry »

Written by Federico

March 30, 2007 at 11:39 pm

Creating a Web Service with NuSOAP

with 2 comments

At
http://dietrich.ganx4.com/nusoap/
, you will find NuSOAP, one of the best-known SOAP classes for PHP. Some might even know its predecessor, SOAPx4. For some time, releases weren’t done very often, but now the project is active again. Nevertheless, you might be better off to check the Concurrent Versions System (CVS) system for the most recent code. Even though you might find several files there, nusoap.php is the one you want.

Calling an XML-RPC Web Service (xmlrpc-pear-client.php)

<?php
  require_once 'nusoap.php';

  $soap = new soap_server;
  $soap->register('add');
  $soap->service($HTTP_RAW_POST_DATA);

  function add($a, $b) {
    return $a + $b;
  }
?>

NOTE

As of this writing, NuSOAP only works under PHP 4, but a PHP 5 port is rumored to be under way.

Creating a Web Service with NuSOAP is really simple because the module takes care of all the painful things, including SOAP. Just follow these steps:

  • Write the function you want to expose as a web method.
  • Instantiate the soap_server class.
  • Register your function with the SOAP serve.
  • Call the service() method and submit $HTTP_RAW_POST_DATA as the parameter.

Written by Federico

March 30, 2007 at 11:20 pm

Posted in PHP

Follow

Get every new post delivered to your Inbox.

Join 1,033 other followers