Example 3.4 Form-Centric Validation /**If the first name or last name fields were left blank, then an error will be returned to client. With this strategy, these checks for the existence of a required field are duplicated. If this validation logic were abstracted into a separate component, it could be reused across forms (see Validation Based on Abstract Types strategy)**/ public Vector validate() { Vector errorCollection = new Vector(); if ((firstname == null) || (firstname.trim.length() < 1)) errorCollection.addElement("firstname required"); if ((lastname == null) || (lastname.trim.length() < 1)) errorCollection.addElement("lastname required"); return errorCollection; }