Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 160: Software Engineering September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak www.cs.sjsu.edu/~mak.

Similar presentations


Presentation on theme: "CS 160: Software Engineering September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak www.cs.sjsu.edu/~mak."— Presentation transcript:

1 CS 160: Software Engineering September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak www.cs.sjsu.edu/~mak

2 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 2 First Page: HTML Murach's Java Servlets and JSP Join our email list To join our email list, enter your name and email address below. Then, click on the Submit button. First name: Last name: Email address: User input Static page!

3 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 3 Dynamic Response Page Dynamically generated content!

4 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak What is a Servlet?  A servlet is a Java class that extends HttpServlet.  Servlets reside on the server computer in a directory that is controlled by Tomcat. Recall that Tomcat is our JSP/servlet engine.  A servlet object is invoked by a URL. URL = Uniform Resource Locator (i.e., a web address)  Servlet objects run on the server computer. _ 4

5 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak What is a Servlet? cont’d  When invoked, a servlet object can: Dynamically generate HTML that will be returned to the client as part of an HTTP response. Perform any application logic. Access the back-end database. Whatever – it’s Java code! _ 5

6 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 6 Response Page as a Servlet package email; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import business.User; import data.UserIO; public class AddToEmailListServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Get parameters from the request. String firstName = request.getParameter("fName"); String lastName = request.getParameter("lName"); String emailAddress = request.getParameter("eAddress"); Get the data for the dynamically generated content.

7 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 7 Response Page as a Servlet, cont’d // Send response to browser. response.setContentType("text/html;charset=UTF-8"); out.println( " \n" + " \n" + " Murach's Java Servlets and JSP \n" + " \n" + " Thanks for joining our email list \n" + " Here is the information that you entered: \n" + " \n" + " First name: \n" + " " + firstName + " \n" + " \n" + " Last name: \n" + " " + lastName + " \n" + " \n" + " Email address: \n" + " " + emailAddress + " \n" + " \n"

8 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 8 Response Page as a Servlet, cont’d + " To enter another email address, click on the Back \n" + "button in your browser or the Return button shown \n" + "below. \n" + "<form action=\"join_email_list.html\" " + " method=\"post\">\n" + " \n" + " \n"); out.close(); } protected void doGet( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } In this example, method doGet() simply calls method doPost() and passes the request and response parameters.

9 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 9 What is a JavaServer Page (JSP)?  A JSP is a file that looks a lot like the HTML that the web server will return to the client as part of an HTTP response. JSPs reside on the server computer in a directory that is controlled by Tomcat.  Special tags in the file represent where dynamically-generated content will appear. A plain HTML page is static. A JSP represents an HTML page that is dynamically generated.

10 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 10 What is a JavaServer Page? cont’d  A JSP is invoked by a URL.  The first time it’s invoked, a JSP is compiled by the JSP/servlet engine (e.g., Tomcat) into a servlet.  A JSP is a much easier way to code a servlet whose main purpose is to return HTML to the client. JSPs are often coded by web page designers who know HTML but not Java. _

11 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 11 Response Page as a JSP <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Murach's Java Servlets and JSP <% // Get parameters from the request. String firstName = request.getParameter("fName"); String lastName = request.getParameter("lName"); String emailAddress = request.getParameter("eAddress"); %> Get the data for the dynamically generated content.

12 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 12 Response Page as a JSP, cont’d Thanks for joining our email list Here is the information that you entered: First name: Last name: Email address:

13 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 13 Response Page as a JSP, cont’d To enter another email address, click on the Back button in your browser or the Return button shown below. The first time this JSP is invoked, Tomcat will compile it into a servlet that is similar to the one you saw earlier.

14 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 14 Unified Modeling Language (UML)  A standardized diagramming notation.  Model the structure and behavior of systems.  system = a set of interacting components Physical, conceptual, or software components. The system can be complex.  model = an abstraction of a system Deal with complexity by leaving out irrelevant details. Model object-oriented software systems. Model real-world systems. _

15 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 15 Unified Modeling Language (UML)  Different types of UML diagrams Class diagrams Object diagrams Activity diagrams Use case diagrams Sequence diagrams and others...

16 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 16 UML Class Diagram Example #1 Organization Team Member (Participant) * * “contains” “consists of” “0, 1, or more” (multiplicity) class Team-Based Organization

17 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 17 UML Class Diagram Example #2 Project Phase (Activity) * Demo Review Member Time Equipment Specification Design Plan Code * Artifact produces Resources * consumes Task * Presentation presents * “subclass of”

18 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 18 Project Phases  Requirements elicitation  Design  Implementation  Testing  Deployment  Maintenance  How do we accomplish these phases? _

19 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 19 Ye Olde Waterfall Model Requirements DesignImplementation Testing

20 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 20 The Waterfall Model, cont’d  Make sure each phase is 100% complete and absolutely correct before proceeding to the next phase.  Big Design Up Front (BDUF) Set requirements in stone before starting the design. Otherwise, you might waste design work on “incorrect” requirements. Spend extra time at the beginning to make sure that the requirements and design are absolutely correct. Source: Wikipedia article on “Waterfall Model”

21 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 21 The Waterfall Model, cont’d  The waterfall model has been mostly discredited. It doesn’t work! But it’s still commonly practiced. Requirements Design Implementation Testing

22 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 22 The Agile Manifesto for Software Development We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value: Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan That is, while there is value in the items on the right, we value the items on the left more. Source: http://agilemanifesto.org/http://agilemanifesto.org/

23 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 23 Agile Software Development  Iterative and incremental development.  Each iteration is a “mini waterfall”: plan (with new requirements) refine design add new code unit and integration testing  Iterations are short: weeks rather than months. _ Requirements Design Implementation Testing

24 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 24 Agile Software Development  The initial iteration produces a conceptual design and a prototype.  Subsequent iterations refine the design and incrementally build the actual product.  Each subsequent iteration may also include a prototype that is quickly produced (rapid prototyping). _

25 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 25 Agile Software Development, cont’d  The initial iteration Prototyping and iterative development are the foundation for Rapid Application Development (RAD) tools.  Agile methodologies range from Extreme Programming (XP) to the Rational Unified Process (RUP). _

26 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 26 Project Phases, cont’d

27 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 27 Project Phases, cont’d  Development is a series of iterations.  Each iteration is a “mini waterfall” consisting of design, code (implementation), and test.  Extreme programmers say: design, test, code

28 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 28 Requirements Elicitation  Requires communication among the developers, clients, and users.  Clients can validate the requirements.  Creates a contract between the client and the developers.  Result: a Functional Specification that the clients can understand. _

29 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 29 Functional Requirements  What the system shall be able to do or allow users to do. “The phone shall use GPS to determine the wearer’s location.” “Users shall be able to choose either Option A or Option B.”  Describe the interactions between the system and its environment independent of its implementation. _

30 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 30 Nonfunctional Requirements  Usability, reliability, performance, supportability, etc. “The system must respond to the user within 15 seconds.” “The system shall run on Windows and Linux servers.” “The new GUI must resemble the existing GUI.”  Constraints that the system must meet. _

31 Computer Science Dept. Fall 2014: September 3 CS 160: Software Engineering © R. Mak 31 Bridging the Gap  Clients and users Have a general idea of what the system should do. Have little experience with software development. Are experts in their domain.  Software developers May have little knowledge of the application domain. Have experience with software technology. Are geeks with poor social skills. _


Download ppt "CS 160: Software Engineering September 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak www.cs.sjsu.edu/~mak."

Similar presentations


Ads by Google