Role of PHP in Defining User-Interface
Role of PHP in Defining User-Interface
1. It helps in thinking about things in the right way We all know that object oriented design is hard. It’s usually harder for programmers, who have just begun in a procedural world. It’s a subtle distinction, especially for those of us with a procedural background. Thinking in terms of these messages is hard; in the same way that static methods in PHP and “God” objects seem so much more familiar. Making a wide use of interfaces when building an application is an easy way of getting out of these bad habits. This approach involves writing down on a separate index card (or small piece of paper) the name of each class, what its responsibility is and which other classes it collaborates with. From here, one can define the public interface of each class (the methods that handle the messages it can send and receive).
2. It helps in making better future-proof code
Having a separate interface for every domain object may at first seem like an overload. But should we bother about it? One reason is the flexibility it gives you in going forward. An example of this is the Virtual Proxy lazy-load pattern. This depends on a placeholder object having exactly the same interface as a real domain object. Whenever one of the Virtual Proxy’s methods is called, it will lazy-load the actual object itself and then the message will be passed through. The interesting part in it is that, by making classes that collaborate with a given class, rely only on interface rather than concrete class in which one can implement a Virtual Proxy pattern at any time, safe in the knowledge none of our application will break.
3. Initialization
When a dialog first opens, the initial focus should be given to the first control where information is required from the user. This control can be determined by the tab order of controls until a control is found where information is required. If the dialog provides simple feedback, or requires simple confirmation from the user, the initial focus may also be assigned to the default button.
4. Multiple Item Selection
Slush Bucket widgets (also known as the Twin Box design) should flow from the left to the right with the source objects on the left and selected files on the right. Slush Buckets should also have the following control buttons, in this order, for moving objects from the source the selected buckets.
5. Validation of Data
Information validation within a wizard should be done in tab order. If the first required field is empty, an informative prompt should be shown in the text area, directing the user to fill in the field. If the first required field is in error, an error message should be shown in the text area. If the first required field is valid, check the next field, and so on. The text area should not be used to display more than one prompt or error at a time. If dialog information is absent or invalid, the Next or Finish buttons should be disabled until the situation is resolved. When resolution occurs, and all of the information has been provided, the Next or Finish buttons may be enabled.