Instantiate Object, Encrypt Data, Design Pattern
The key terms of this Computer Science Exam include Iterator, Design Pattern, Instantiate Object, Encrypt Data, Software.
Adaptor
structural design pattern – allows interface of existing class to be used as another interface & allows objects w/ incompatible interfaces to collaborate
adaptor is a
Uses dependency Inversion Principle
– adaptor implements an interface that Client calls on
Factory
creational design pattern – replace direct object construction calls (new) with a factory method
Establishing constructor
DriverManager.getConnection(URI)
Not coupled to client
Singleton
creational design patter – ensure class has only one instance & providing global access point to instance
Don’t want several instances to access same info
Use static final
Java application – Runtime class – single instance
– use getRuntime to get the one instance of Runtime
Iterator
behavioral design pattern – traverse elements of a collection w/out exposing underlying representation
Open/close principle
– when creating new iterator — build on existing iterator
Dependency Injection Pattern
Instantiate object outside class –> inject it into the class (pass into constructor)
In Model class, passes Database object into class
Benefit: looser coupling, enable separation of concerns (class does not need to know how to instantiate object)
Object being injected = SERVICE
code passing in service = INJECTOR
MVC Pattern
For web applications
higher level
Model <–> Controller <–> View
Gang Of Four – Design Patterns
Creational Patterns – how to create objects
Structural Patterns – how to organize classes/objects
Behavioral Patterns – how classes interact with each other
Composite
structural design pattern – compose objects —> tree structures to represent whole-part hierarchies
Grouping & ungrouping primitive types
– treat a group of objects same way as single instance
Enables nesting
HTTP v. HTTPS
HTTP allows client-server communication
HTTPS – HTTP Secure
– guarantees visitors data is coming from server
– encrypts data being transmitted
SSL Certificate
digital certificate – authenticates identity of website & encrypts info sent to server using SSL tech
Serves two purpose
– authenticates the identity of the website (this guarantees visitors that they’re not on a bogus site)
– encrypts the data that’s being transmitted
How to use HTTPS on SparkJava
1. generate certificate using openssl
2. call secure before setting up routes
Software requirement specification
Problem Statement
Potential Clients
Proposed Solution
Functional Requirements
– must haves
– nice to haves
Software Architecture
Wire Frame
@Before
Run before every test
DaoException
Runtime Exception
CRUD
create, read, update, delete
DAO
Data Access Object – design pattern
REST
Representational State Transfer
client-server architecture
server and client do not know about each other – stateless
RESTful System
uses REST model
uses HTTP to transfer protocol
HTTP
Hypertext Transfer Protocol
GET – retreat resources
POST – create
PUT – update
DELETE – delete
HTTP request has
header (info about request) , body (data, optional), path (address)
Interface Segregation Principle
when a class implements an interface, all the functions implemented should be meaningful
if not, separate interface into multiple ones
Composition
parent uses the child where the child class used cannot exist on it own
instance of child created inside parent
Aggregation
child instance passed into parent through constructor
deleting parent child still exist