Thursday, February 2, 2017

Web Services/Application History.

Java Servlets in early days:
  • Advantages:
    • Much better than CGI, ISAPI, lighter plumbing.
    • Allowed for scalable, robust web development.
  • Disadvantages
    • Hard to incorporate sophisticated HTML.
    • Harder to update HTML design, which could be designed in Dream Weaver.
    • Too much dependency on HTML embedded in Java code.
Then comes JSP:
  • Advantages: 
    • Closer to HTML.
    • Same as servlets with improvement in manipulation of display characteristics.
  • Disadvantages:
    • developers must deal more directly with the view of the application.
    • Syntax quickly becomes cryptic because of the mixing of code and display
    • Too much dependency on JAVA embedded in HTML.
Meet Model-View-Controller:
  • SmallTalk Language creator in 1980's came up with MVC. 
  • Gang of Four wrote "Design Patterns" in 1994 (Wiki).
  • Model represents the data that application is about. (eg. a list of numbers)
  • View is the visual representation of the model (eg. a spreadsheet/graph/chart)
  • Controller is how they interact (eg. keyboard changes cell value, mouse changes graph size)
MVC applications in Java web development (Model 2):
  • The model is represented by Java Beans (or Enterprise Java Beans)
    • Java Beans - a method to encapsulate information.
  • The view uses JSP.
  • The controller is a servlet that drives the process.
  • How it works:
    • The user requests a servlet via a URL or a link.
    • The servlet instantiates one or more Java Beans and calls methods on them.
    • The beans with displayable fields are added to one of the standards collections (eg.request or sessions)
    • Control is forwarded to a JSP to display the results.
Stay tuned...


No comments:

Post a Comment