concept person in category security

appears as: person, person
Secure by Design

This is an excerpt from Manning's book Secure by Design.

  • It assumes that the person writing the code can think of every potential vulnerability that might occur now or in the future.
  • Listing 7.7 MaritalStatus helper object encapsulating the rules of marital status
    import static org.apache.commons.lang3.Validate.validState;
    
    public class MaritalStatus {
    
        private boolean married = false;    #1  
    
        public void date() {    #2  
            validState(!married,    #3  
                    "Not appropriate to date when married");
        }
    
        public void marry() {
            validState(!married);    #3  
            married = true;
        }
    
        public void divorce() {
            validState(married);    #4  
            married = false;
        }
    }
    
    #1   We all start out as singles.
    #2   No need to know the datee, it’s all about the person.
    #3   To date or marry, you must be unmarried.
    #4   You can only divorce if you’re married.

    Figure 7.5 The life of a person viewed in two ways: as a single entity and as a chain of entities.

    figure07-05.eps