Lecture 1: Architecture UML Principles Flashcards

1
Q

Name an architectural design pattern.

A

layering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is layering and what is it’s purpose?

A

Layering is separation of concerns so that each concern can be handled independently without affecting another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the different layers of layering?

A

UI, Service/Business Logic, Database Access, Database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What makes up the presentation layer in the multi-layer architecture used in CSE 136?

A

Two things: 1. The User Interface (which can contain ASP.NET MVC, Win Forms, WPF, and mobile) 2. The Presentation logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What makes up the business layer of the multi-layer architecture used in CSE 136?

A

Four things: 1. Application Logic/Service Layer (WCF -> windows communication foundation and DTO Adapters) 2. Services 3. Workflows 4. Object/Domain Model (Design patterns)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What makes up the data access layer of the multi-layer architecture used in CSE 136?

A

The persistence layer (O/RM, custom data context, ADO.NET)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What makes up the database of the multi-layer architecture use in CSE 136?

A

The SQL server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is data transferred between the presentation layer and the business layer?

A

A Data Transfer Object (DTO) in the form of xml or binary data communicates from the Presentation Layer’s Presentation Logic to the Business Layer’s Application Logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is data transferred between the business layer to the data access layer?

A

A DTO in the form of Object Relational Mapping communications from the Business Layer’s Application Logic to the Data Access Layer’s Persistence layer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are forms of Object Relational Mapping in the Data Access Layer and what does CSE 136 use?

A
  1. Unit of work - many updates to db in one atomic action 2. Repository - mock the database in memory 3. Data Mapper - map C# classes to database tables 4. Query Object - object-oriented query (entity framework which removes the need to learn SQL programming) 5. Lazy Loading - on-demand loading the detail data 6. CSE 136 uses ADO.NET and Entity Framework
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some business/service layer patterns?

A
  1. Domain Model (object oriented) - inheritance, entities and relationships - POCO -> plain old class objects 2. Business Logic - Validation - Rules
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are some Web Presentation Patterns and what are the patterns covered in CSE 136?

A

Covered in CSE 136: - Model-View-Controller - Model-View View-Model (JavaScript/AJAX) Not covered: - Model-View-Presenter (ASP.NET webforms) - Front Controller - Page Controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the Dependency Inversion Principle?

A

Two parts: A. High-level modules should not depend on low-level modules. Both should depend on abstractions. B. Abstractions should not depend on details. Details should depend on abstractions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Dependency Inversion Principle used for?

A

to integrate the layers together

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Name two examples of use for the Dependency Inversion Principle.

A
  1. Ajax calls to service interface so we can return hard-coded value while developing business logic 2. Business layer calls repository interface so we can mock the database when unit testing business logic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is UML?

A

The Unified Modeling Language (UML) is a general-purpose, developmental, modeling language that is intended to provide a standard way to visualize the design of a system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the 5 different UML diagram types used in CSE 136?

A
  1. Domain Model 2. Usage Diagram 3. Robust Diagram 4. Sequence Diagram 5. Class Diagram - Communicate with developers of your design
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are the uses for Domain Model Diagrams?

A
  1. Define high level entities and relationships - relationships can be is-a or has-a 2. Business terminologies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Draw a domain model diagram.

A

see slide 20.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Explain the example of domain model diagram on slide 20

A

○ Student has a student account ○ Staff has access to student account -> sees modification to address ○ Department chair has chair account and has access to courses ○ Pre requisite has access to course ○ Student has enrollment ○ Enrollment has a schedule ○ Instructor has account ○ Schedule has an instructor account ○ Cape belongs to schedule and student

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are the uses for Use Case Diagrams?

A
  • identify what user is trying to do on the system (show users and system interaction)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Draw a Use Case Diagram

A

see slide 21.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are the uses for a Use Case Package?

A

same as use case diagrams: - to identify what user is trying to do on the system - use it when circles get to pick on use case diagrams

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Draw a Use Case Package

A

see slide 22.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are the uses for a Robust Diagram?

A
  • to show the “flow” or “process” of the system between entities - to show how the user interacts with the system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

In Robust Diagrams, what are nouns and verbs? How can they be combined?

A
  1. Noun: user, page, data Verb: action 2. The pattern is noun verb* noun BUT must have at least one verb between nouns. CAN have more than one verb
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Draw an example of a robust diagram for login activity

A

See slide 23.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Draw an example of a robust diagram for course planning

A

see slide 22

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Explain the example of a Robust Diagram on slide 23.

A

○ User had to log in

○ Log in page

○ Somebody has to generate the page for user to see the page

○ Now user to see the page

○ User enter password

○ If it fails, go back to login

○ Success render homepage

○ User sees homepage ○ Always noun verb noun

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Explain the example of a Robust Diagram on slide 24.

A
  • Department chair wants to plan for next year
  • Course page renders actual page
  • Wants to create a course
  • Gets list of current courses
  • Drag and drop into quarters
  • Add a course by dragging and drop into fall
  • Writes into database
  • When its done, it updates
  • Drag and drop the other way, it’ll delete from course plan
  • Then it’ll update the UI
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is the purpose of Sequence Diagrams?

A

to Identify class models - class objects - class methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What do Sequence Diagrams show?

A
  • show the detailed “flow” or “process” between layers - are the most detailed of the diagrams
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Draw a Sequence Diagram.

A

See slide 25. Note that it is ordered from top to bottom.

34
Q

What are the uses of Class Diagrams?

A

Used for developers to understand the OO design

35
Q

What is Class Diagram class notation?

A

see slide 26

36
Q

What is the Class Diagram class notation variation that emphasizes operations?

A

see slide 26

37
Q

What is the Class Diagram class notation variation that emphasizes attributes?

A

see slide 26

38
Q

What is the Class Diagram class notation variation that emphasizes class objects?

A

see slide 26

39
Q

What are the four different object relationships depicted in Class Diagrams?

A
  1. Association
  2. Generalization
  3. Aggregation
  4. Composition
40
Q

What is the Association relationship? how is it represented in class diagrams?

A
  • car is associated with a driver - one car has one driver - it is represented with a straight line from one class to another
41
Q

What is in Generalization object relationship? how is it represented in class diagrams?

A
  • Sedan is a type of car - arrow going from sedan to car
42
Q

What is the Aggregation relationships? How is it represented in class diagrams?

A
  • one can exist without the other - both objects are created outside of each other in a separate class, one has a pointer to the other - passed through to an object using a constructor - it is represented using a diamond
43
Q

What is the Composition relationship? How is it represented in class diagrams?

A
  • object b is dependent on object a - Object that belongs is created in the class that it belongs to - has a relationship - represented with a filled in diamond. -Ex. Filled in diamond on Car side, line on Frame side (car has a frame)
44
Q

Code an example of a composition relationship between a car and an engine.

A

see slide 28

45
Q

Code an example of an aggregation relationship between a person and an address

A

see slide 29

46
Q

What are two data access layer patterns?

A

Lazy Loading and Repository

47
Q

Does sequence diagram come before or after robust diagram?

A

After because you need the flow defined in robust diagram before you go in detail

48
Q

What’s the difference between aggregation and composition?

A
  • aggregation is when existence doesn’t depend on each other whereas composition is one object cannot exist without the other
49
Q

Common Design Principles: What is KISS?

A

keep it simple stupid (don’t over-complicate)

50
Q

Common Design Principles: What is DRY?

A

don’t repeat yourself

51
Q

Common Design Principles: What is tell, don’t ask?

A
  • tell objects what to do - don’t ask an object about its internal state
52
Q

Common Design Principles: What is YAGNI?

A
  • you ain’t gonna need it (remove the code that is not being used, don’t just comment it out)
53
Q

What are the Object Oriented Design Principles?

A

SOLID:

  • Single Responsibility Principle
  • Open-Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle
54
Q

OODP: Explain the Single Responsibility principle?

A
  • The single responsibility principle is that every class should have responsibility over a single part of functionality and that responsibility should be entirely encapsulated by the class.
55
Q

OODP: How do we use the Single Responsibility principle?

A
  • we break apart a program by functionality, keeping similar functions together
56
Q

OODP: What is the purpose/ pros of SRP?

A
  • Easier to maintain the code: if we need to modify some functionality, SRP makes it so we only have to modify only the classes related to the functionality. If multiple functionality are in one class, then you might break unrelated working code which means extra time spent testing to make sure everything works.
57
Q

OODP: What are the two things that make up SRP?

A
  • High Cohesion: Each object does one set of related functions - Low Coupling: Objects need to interact and communicate through interfaces (list of public methods)
58
Q

OODP: What is the Open/Closed principle?

A
  • open for extension but closed for modification
59
Q

OODP: How is the Open/Closed principle achieved?

A
  • through inheritance and override methods - inheritance allows you to extend from a super class, overriding methods allows you to extend functionality from a super class - no modification to the original class
60
Q

OODP: What are the pros to the Open/Closed principle?

A
  • allows code re-use
  • less buggy, not breaking somebody else’s code just adding to it
61
Q

OODP: What is Liskov substitution?

A
  • Objects in a program should be replaceable with instances of their subtypes without altering the correctness of the program
62
Q

OODP: Explain how Liskov Substitution works for a GradStudent class that extends a Student class.

A
  • a gad student that inherits from student, can use base.method() to use the superclasses methods
63
Q

OODP: How is Liskov substitution similar to the open/ close principle?

A

It is similar to open and close principle, but it’s more close/close principle because you aren’t modifying the superclass method for extension.

64
Q

OODP: What is Interface segregation?

A

The interface-segregation principle (ISP) states that no client should be forced to depend on methods it does not use.

ISP splits interfaces which are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them.

65
Q

OODP: What problem does Interface segregation solve and how?

A

Problem: lots of no implementation methods when implementing a big interface

Solution: ISP -> breaking apart a large interface definition (similar to single responsibilites)

66
Q

OODP: Given this diagram, redraw the class diagram to follow interface segregation

A

see slide 39

67
Q

OODP: What are the advantages to interface segregation?

A
  • no more “not implemented” methods
68
Q

OODP: What problem does the dependency inversion principle solve and how?

A

Problem: writing unit test for something that needs access to real info (database or notifying people)

Solution: inject the database or notifyer using a class constructor so can use a fake database or notifyer

This converts a composition into an aggregation

69
Q

OODP: Given this diagram, redraw the class diagram to follow dependency inversion.

A

see slide 40

70
Q

OODP: What are the pros and cons of dependency inversion?

A

Pros: Create testable systems (Write unit test w/o affecting other logic)

Cons: have to know what’s inside the code because have to pass it in (would have to know if you have to pass in a database, or a file, etc)

71
Q

What is the Object Oriented Paradigm?

A

AEIP

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
72
Q

OOP: Explain Abstraction and it’s purpose

A
  • Only show the generalization (not the detail)
  • An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer.
  • Ex. “I am an A student”
  • used to manage complexity so programmers can know the functionality of an object or method without having to know all the implementation details (closely related to encapsulation)
73
Q

OOP: What is Encapsulation and what is it’s purpose?

A
  • hiding of data implementation by restricting access to accessors and mutators
  • purpose is for security: prevents missuse of instance variables because accessors and mutators can have validation code
74
Q

OOP: What is inheritance and what is it used for?

A

Allows a class to have the same behavior as another class and then extend that behavior

  • purpose is for code re-use
75
Q

OOP: What is polymorphism and how is it used?

A
  • Two or more objects respond to the same base object
  • used for overriding
76
Q

What are the three parts of .NET and how do they interact with each other?

A

CLR (Common Language Runtime), Programming Tools, BCL (Base Class Library)

77
Q

.NET: What is the CLR and what does it do?

A
  • CLR is Common Language Runtime.
  • it’s like the Java Virtual Machine
  • CLR handles:
  • JIT Compiler
  • Code execution
  • Memory management
  • Garbage collection
  • Code safety verification
78
Q

.NET: What are .NET programming tools?

A
  • The Visual Studio integrated development environment
  • .NET-compliant compilers (e.g., C#, VB, and managed C++)
  • Debugger
  • Server-side improvements, such as ASP.NET/MVC
79
Q

.NET: What is the Base Class Library?

A
  • General base classes
    • Provide you with an extremely powerful set of tools for a wide range of programming tasks, such as string manipulation, security, and encryption
  • ASP.NET class library: For building web-based applications
  • ADO.NET class library: For database manipulation
  • Windows Forms class library: For building Windows GUI applications
80
Q

.NET: How does a C# file get compiled?

A

see slide 46