MVC is appropriate for interactive SaaS apps with a variety of model types

Mvc is appropriate for interactive saas apps with a

This preview shows page 88 - 91 out of 517 pages.

MVC is appropriate for interactive SaaS apps with a variety of model types, where it makes sense to situate controllers and views along with each type of model. Other architectural patterns may be
Image of page 88
more appropriate for smaller apps with fewer models or a smaller repertoire of operations. Self-Check 2.5.1. Which tier(s) in the three-tier architecture are involved in handling each of the following: (a) models, (b) controllers, (c) views? (a) models: logic and persistence tiers; (b) controllers: logic and presentation tiers; (c) views: logic and presentation tiers. 2.6 500 Feet: Active Record for Models How do the models, views, and controllers actually do their jobs? Again, we can go far by describing them in terms of patterns. Every nontrivial application needs to store and manipulate persistent data. Whether using a database, a plain file, or other persistent storage location, we need a way to convert between the data structures or objects manipulated by the application code and the way that data is stored. In the version of RottenPotatoes used in this chapter, the only persistent data is information about movies. Each movie’s attributes include its title, release date, MPAA rating, and short “blurb” summarizing the movie. A naive approach might be to store the movie information in a plain text file, with one line of the file corresponding to one movie and attributes separated by commas: 1 Gone with the Wind,G,1939-12-15,An American classic ... 2 Casablanca,PG,1942-11-26,Casablanca is a classic and... To retrieve movie information, we would read each line of the file and split it into fields at the commas. Of course we will run into a problem with the movie Food, Inc. whose title contains a comma: 1 Food, Inc.,PG,2008-09-07,The current method of raw... We might try to fix this by surrounding each field with quote marks: 1 "Food, Inc.","PG","2008-09-07","The current method of raw..." ...which will be fine until we try to enter the movie Waiting for ”Superman”. As this example shows, devising even a simple storage format involves tricky pitfalls, and would require writing code to convert an in-memory object to our storage representation (called marshalling or serializing the object) and vice versa ( unmarshalling or deserializing ).
Image of page 89
Edgar F. “Ted” Codd (1923–2003) received the 1981 Turing Award for inventing the relational algebra formalism underlying relational databases. Fortunately, the need to persist objects is so common that several design patterns have evolved to fulfill it. A subset of these patterns makes use of structured storage —storage systems that allow you to simply specify the desired structure of stored objects rather than writing explicit code to create that structure, and in some cases, to specify relationships connecting objects of different types. Relational database management systems (RDBMSs) evolved in the early 1970s as elegant structured storage systems whose design was based on a formalism for representing structure and relationships. We will discuss
Image of page 90
Image of page 91

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors