Quiz #1 Name:

infestationwatchΛογισμικό & κατασκευή λογ/κού

28 Οκτ 2013 (πριν από 3 χρόνια και 11 μήνες)

81 εμφανίσεις

Quiz #1





Name:




5 points each

Application Servers and Servlets

1.

Assume you have just written the servlet TestServlet.java and compiled it in
Eclipse. Which files and directory structures do you need to update so that
Tomcat will execute that servle
t when you make the following call in your
browser:


http://localhost:8080/demo/runTest



1.

Create a document root called demo under

…Tomcat 4.1
\
webapps with a subfolder called WEB
-
INF


2.

Move your ser
vlet class files to the folder



…Tomcat 4.1
\
webapps
\
WEB
-
INF
\
classes


3.

Update the context path in

…Tomcat 4.1
\
conf
\
server.xml file.

4.

Define the servlet and servlet mappings in

…Tomcat 4.1
\
webapps
\
demo
\
WEB
-
INFweb.xml.



2.

Where do you put the class
files for Tomcat (what is the path of the folder)?



In the folder …Tomcat 4.1
\
webapps
\
WEB
-
INF
\
classes


3.

Update this web.xml file so that the servlet TestServlet.class is executed from
http://localhost:808
0/demo/test

assuming /demo has already been set as a context
path in Tomcat.


<?xml version="1.0" encoding="ISO
-
8859
-
1"?>

<!DOCTYPE web
-
app


PUBLIC "
-
//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"


"http://java.sun.com/dtd/web
-
app_2_3.dtd">

<web
-
app>


<display
-
name>Demo examples</display
-
name>


<description>


Demo servlets and JSP pages.


</description>



<!
--

Define servlets that are included in the example application
--
>



<servlet>


<servlet
-
name>Simple</servlet
-
name>


<servlet
-
class>SimpleServlet</servlet
-
class>


</servlet>



<servlet>


<servlet
-
name>TestServlet</servlet
-
name>


<servlet
-
class>TestServlet</servlet
-
class>


</servlet>



<servlet
-
mapping>


<servlet
-
name>invoke
r</servlet
-
name>


<url
-
pattern>/servlet/*</url
-
pattern>


</servlet
-
mapping>



<servlet
-
mapping>


<servlet
-
name>Simple</servlet
-
name>


<url
-
pattern>/runSimple</url
-
pattern>


</servlet
-
mapping>



<servlet
-
mapping>


<se
rvlet
-
name>TestServlet</servlet
-
name>


<url
-
pattern>/test</url
-
pattern>


</servlet
-
mappi ng>

</web
-
app>




4.

What are some reasons to choose Tomcat as an application server?



1.

It is easy to manage and administer.


2.

It is free.


3.

It is an
industry standard in smaller and midsize companies.



Eclipse

5.

How do you compile a Java program in Eclipse?



Go to File
-
Save.


6.

How do you get your class files from Eclipse to Tomcat?



Use File
-
Export and export them to the proper directory in Tomca
t.


7.

How do you point to an external jar file that you might need in Eclipse?



Right
-
click on the project name, select Properties. Then click on the Java
Build Path, click on the libraries tab and select Add External JARs.



JSP’s

8.

Assume the context

path is /demo. Where would you put the jsp input.jsp if the
servlet made this call:



getServletConfig().getServletContext().getRequestDispatcher(
"/jsp
/jsptoserv/initial.jsp"
).forward(request,

response);



In the directory …Tomcat 4.1
\
webapps
\
demo
\
jsp
\
jsptoserv



9.

Why do we use JSP’s if we can just write HTML from the servlet? What are the
benefits of using JSP’s.



JSP’s allow for the separation of design from business logic (Remember the
3
-
tier architecture). Using jsp’s a design change can be don
e by a UI
designer instead of a software engineer.


SDLC

10.

What are the various phases of the software development life cycle (SDLC)?



1.

Feasability study and project planning


2.

Requirements definition and systems analysis


3.

Systems and program
design


4.

Implementation


5.

Unit testing


6.

Acceptance, installation and depoloyment


7.

Maintenance


11.

Name 3 of the 7 factors that have altered software engineering practice in recent
years.


1.

Shifts in the economics of computing: lower hardware
costs and
greater development and maintenance costs

2.

Availability of powerful desktop computing

3.

Extensive local and wide
-
area networking

4.

Availability and adoption of OO technology


5.

GUI’s using windows, icons, menus and pointers


6.

Unpredictabil
ity of the waterfall method of software development.


7.

Criticality of time
-
to
-
market for commercial products


Readings

12.

What kinds of activities in the SDLC can be performed in parallel?



Test planning can take place in parallel with requirements, d
esign, and
coding activities. Low
-
level design and coding on different parts of the
system can take place in parallel.


See chapter 3 for more details.



13.

Name and describe two SDLC models?



Some example SDLC models are the waterfall method and the sp
iral method.
See chapter 2 for descriptions.


14.

How can adding personnel hurt project? When is adding people to a project
good? bad?


Adding personnel requires extra time for training and an increase in
communication channels and costs. These added c
osts may outweigh the
time
-
savings from having extra people. However, development time, strictly
defined, may be shortened by adding more people, but actual project time
would probably increase due to increased training, communication, and
management effo
rt. It also depends a great deal on when in the project
lifecycle people are added. A project that starts off with more people will
probably finish earlier than if it started out with fewer people. However,
adding those people near the end of the projec
t is less likely to be beneficial.


See chapter 3 for more details.


15.

What factors impact decision to buy vs. build software applications?



Factors to consider include:


1.

how long it will take to build in
-
house;


2.

how soon the software is needed;


3.

how many programmers would be needed;

4.

whether or not the technical and managerial expertise is available in
-
house;


5.

the quality of the purchased software;


6.

maintenance costs, both in
-
house and through the vendor


See chapter 3 for more details.


16.

What kinds of problems should you look for when doing a requirements review?



Here is a general checklist:

1.

For each function described, are all conditions under which the
function can be invoked specified?

2.

For each function described, are all
conditions under which the
function can terminate specified?

3.

For each user input, are all responses specified for invalid input?

4.

For each output, is the format specified in all situations?

5.

Are there ambiguous statements (e.g. the use of “can” or “
should”)?

6.

Are there any “to be specified” features?

7.

Are all statements understandable?

8.

Is each requirement specific enough to be tested?


See chapter 4 for more details.


17.

Can an object
-
oriented approach be used to develop any system? What are

the
strengths and weaknesses of OO design. Give an example of a system where OO
would not be an appropriate development strategy.



Any system can be expressed using an object
-
oriented approach, but that
does not mean this is always the right one. OO ha
s many strengths. It allows
a consistent vocabulary to be used across different phases of the development
process, facilitating traceability. It also allows for the design of classes that
mirror real
-
life problem components. In addition, OO facilitates
information hiding and encapsulation.



However, OO does have its weaknesses. Maintenance can be difficult
because information about a particular aspect of a system can be spread out
across different diagrams. Information hiding can also make impact anal
ysis
more difficult. Furthermore, inheritance and polymorphism can create
hard
-
to
-
understand systems if used poorly.



One type of system that OO may not be the best design choice is rule
-
based
systems. When a system is mostly concerned with algorithmic

processing or
rule look
-
up, OO does not provide many benefits.

See chapter 6 for more details.



18.

What is a Gantt chart used for?


The Gantt chart is typically used to by project managers to track the
progress of the various project tasks and monitor t
he various project
resources.


See chapter 3 for more details.


19.

What is the standard modeling language used for OO design and what are some
popular tools used to develop these models?


Universal Modeling Language (UML) is the industry standard for deve
loping
OO models. Rational Rose, TogetherJ and EclipseUML are some popular
UML tools.


See chapter 4 and lecture notes for more details.


20.

List the characteristics of a system for which prototyping is most appropriate?



Characteristics may include:

1.

The system requires functionality that is substantially different from
anything implemented before.


2.

There are several design options for various parts of the system.

3.

Implementation of the system will require new technology
(techniques, platforms, l
anguages) that the developers are not familiar
with.

4.

There are some requirements that may not be implementable.

See chapter 5 for more details.



Extra Credit


5 points

1.

What are two other popular application servers besides Tomcat?



WebSphere and
WebLogic are the two most popular, but there are many
others.



2.

Describe the 3
-
tier system architecture design and why you might use this design.



Presentation layer (design or UI) is separate from the business logic layer
(e.g. servlets) which is sepa
rate from the data layer (e.g. the database).