Skip to content

Object Oriented and Testable Approach

Jonathan Zhang edited this page Dec 12, 2018 · 4 revisions

Consider use cases around the application user.

Requirements:

  • List all users
  • Search users
  • View complete profile of a user
  • Create a new user
  • Modify or delete a user

Now, we need to come up with a data structure for users with built-in methods to fit the above use cases.

Editing User Model:

{
 "username":"patrix",
 "officeName":"Newyork",
 "officeId":36,
 "firstname":"Patrick New",
 "lastname":"Asare-Frimpong",
 "email":"[email protected]",
 "roles":[{"Rolename":"Admin","RoleId":1},
          {"Rolename":"SuperUser","RoleId":6},
          {"Rolename":"LoanOfficer","RoleId":3}
}

Submitting User Model (Strips Unwanted Data):

{
 "username":"patrix",
 "officeId":36,
 "firstname":"Patrick New",
 "lastname":"Asare-Frimpong",
 "email":"[email protected]",
 "roles":[1,6,3]
}

For View:

For View

For Edit:

For Edit

For Submit:

For Submit

username: mifos

password: password

Clone this wiki locally