Java assignment help
CS444 - Software Engineering
Assignment 3 - The Domain and Service Layers
1 Background
When designing a software system, one of the most significant early products of the analysis and design workflows is the logical architecture of the system. Logical architecture can take many forms, including client-server, peer-to-peer, pipe-and-filter, etc. Refer to the book, “Software Architecture: Perspectives on an Emerging Discipline” by Shaw and Garlan, for a more comprehensive discussion on the various software architectural styles. In this assignment, we will use a layered software architecture. For our purposes, a layer is nothing more than a fairly coarse-grained grouping of classes, organized into Java packages, with a cohesive set of responsibilities for a major function in the system. We have already implemented one layer when we constructed the user interface, i.e., the presentation layer. For this iteration, we will design and build two additional layers of our application: the domain layer and the service layer. Each of these layers has a distinct responsibility, and therefore should be organized into separate abstractions.
2 Requirements
Building on the existing project, which by now consists only of a presentation layer, we will add two additional layers, each implemented as classes contained within a Java package, that represent the domain layer and the service layer. Each layer is discussed separately.
Domain Layer. The domain layer represents entities of significance in the problem domain. For example, in a bookstore application we might have entities such as books, customers, accounts, and so forth. These real-world entities are considered conceptual classes, in that they refer to things familiar within the problem domain, and aren’t simply made-up software constructs such as windows and scrollbars. The domain layer of your application will consist of Java classes that represent these conceptual classes. Therefore, for a bookstore application there would be a Java class representing a book, containing fields that appropriately and sufficiently describe attributes of a book as we know it in the real world. In your list of things application, clearly you will need to develop a class that represents that “thing”. Another conceptual class you will need to implement is an Account class, since the application should support multiple users, each with separate login credentials. Accounts, although intangible, are real-world entities and therefore should be implemented as classes within the domain layer.
Identifying these classes and developing a domain model illustrating their attributes and asso- ciations is the purpose of the Analysis step in software development. We’re not going to develop a domain model in this assignment since the problem domain is sufficiently simple and straightfor- ward, but you do need to consider any relevant conceptual classes and implement them in Java as part of the domain layer when you build your project.
1
As you progress from Analysis to Design (the specific delineation between steps is oftentimes quite blurry), you will transition from discovery of conceptual classes to invention of other (soft- ware) classes. These additional classes arise once you begin thinking about design and how objects will actually interact to fulfill their responsibilities. They also arise from another design activity: application of design patterns. We discuss design patterns later in the term. In essence, during design you invent classes that are necessary in order to make things work. In this project you will have at least one additional class: a Login class that will encapsulate an identifier, i.e., a user name, and a password field.
Use the naming convention CS444<your name>.domain for naming the Java package represent- ing the domain layer.
Please keep in mind, there is little to no functionality implemented at the domain layer. The classes here are those representing data to be persisted in the application. The actual functionality will be implemented in other layers. Refer to the PowerPoint slides, Developing the Domain Layer, for instructions on how to build the domain layer for your application.
Service Layer. The service layer is where the application logic will be implemented. As a general rule, a layer only calls on services implemented in the layer beneath it, i.e., the classes based on Java Swing in the presentation layer will call on services in the service layer, and the service layer will access classes in the domain layer to fulfill its responsibilities. A layered architecture structured in this manner is not the only way to build an application, but it is extremely common.
Use the naming convention CS444<your name>.service for naming the Java package repre- senting the service layer.
In this project, the Account class will be the primary container for domain objects at run time, and as such is the centerpiece of the service layer. The use of interfaces and classes that imple- ment them is a common pattern in object-oriented design. We will use an interface for services on account objects, and implement that interface using a class called AccountSvcImpl. Note that this class will only provide for operations on Account objects, not the things maintained in the list. Those are separate use cases that will be implemented in later iterations. Also note that we are not yet linking the layers, so this iteration will not provide any functionality of interest to the user, only structure. We will integrate layers and build functionality in the next iteration. Detailed instructions for building the service layer can be found in the PowerPoint slides, Developing the Service Layer.
Corrections from Previous Iteration. This project is being designed and implemented itera- tively. As discussed earlier in class, each iteration provides an opportunity to revise and improve the code based on test results and stakeholder feedback. With that in mind, any suggested improve- ments to the presentation layer from the previous iteration should be implemented in this iteration, even if points were not deducted for them. Refer to the Assignment 3 Rubric for specific details.
Deliverables. Submit your unit-tested and debugged NetBeans project implementing the presen- tation, service, and domain layers as a zip file to the course dropbox by the posted due date. Please verify the zip file contains the correct project files and directory structure (and no more) before submitting.
2