CMPS 415 (Enterprise Systems) Flashcards
What is the purpose of layering?
- separation of concerns
- Allow the use of Single responsibility principle
- Allows the use of Dependency injection principle
- Makes Unit testing easier
What are the three main layers, and what are their purpose?
- Data Acess Layer (DLL)
- Domain/Business Logic Layer (BLL)
-Presitation Layer
DAL (Data Access Layer) The interface between your business logic (or domain logic) and the data storage (your persistent data storage, which could be your database, xml files).
BLL (Business Logic Layer) The portion of an enterprise system that determines how data is transformed or calculated, and how it is routed to people or software.
Presentation Layer The layer that actually displays your data.
What is TDD?
Test Driven Development is the process of writing the test first, and then writing the minimal amount of code for that test to pass.
What is unit testing?
Trying to isolate the smallest amount of testable code to verify its behavior.
What is the singleton pattern?
Design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system.
private static SqlServerDAO Instance {get; set;} // private SqlServerDAO() { } public static SqlServerDAO GetInstance() { //if very first call to get a query is null, it will create a new instance. if(Instance == null) { Instance = new SqlServerDAO(); } return Instance; }
public class Junk() { public void Junk() { var sqlServerDAO = SqlServerDAO.GetInstance(); }
private void DoMoreJunk() { var sqlServerDAO = SqlServerDAO.GetInstance(); } }
Every class should have a responsiblity over a single part of the functionality provided by the software, and that responsibility should be entirey encasuplated by the class
What is Dependcy Inversion
High-level modeules should not depend on low-level modules.
Abstractions should not depend on details. Details should dependon upon abstractions
What is the Singleton Pattern
Advantages of Unit Testing?
Finds problems early
Facilitates changes
Simplifies integration
Documentation
Aids in OOD
Disadvantages of Unit Testing
Time taken to write the program
Limited to test cases
Only tests the functionality of the units themselves
Can only show the presence or absence or particular errors
Single Responsibility Principle
A class or module should have one, and only one, reason to change.
A class should do one thing
A class should have one responsibility
Dependancy Inversion Principle
Refers to specific form of decoupling software modules
The high level classes are not working directly with low level classes; they are using interfaces as an abstract layer