CA Flashcards

1
Q

What is software architecture?

A

Architecture represents the significant design decisions that shape a system, where significant is measured by cost of change.

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

What is good architecture?

A

Meets the needs of its users, developers, and owners at a given point in time, but it also meets them over time.

The path we are most interested in recognizes the softness of software and aims to preserve it as a first-class property. Architecture is a hypothesis, that needs to be proven by implementation and measurement.

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

What is the goal of software architecture?

A

To minimize the human resources required to build and maintain the required system.

The measure of design quality is simply the measure of the effort required to meet the needs of the customer. If that effort is low and stays low throughout the lifetime of the system, the design is good.

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

What does increased engineering staff but stagnated product size indicate?

A

That the cost per line of code has changed over time. The trend is not sustainable and will cut into the profit of the business model.

Effort has been diverted away from features and is now consumed with managing the mess.

Making a mess is always slower than staying clean, no matter which time scale we are using. The only way to go fast, it to go well.

The solution is not to redesign everything from scratch, the same overconfidence that lead to the mess will lead to the same mess again.

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

What are software engineers hired to do?

A

Make machines behave in such a way that makes or saves money for the stakeholders. This is done by helping stakeholders develop a function requirements specification and implement it, when something goes wrong the bug is fixed. The other half of their work is to fulfill the purpose of software, namely, being soft - that is easy to change.

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

How easy should changes be in software?

A

A good architecture makes the difficulty of implementing a change proportional to its scope, not the type of change.

It is this difference between scope and shape that often drives the growth in software development cost.

The more the architecture prefers one shape over another, the more likely new features will be harder and harder to fit into that structure. Therefore architectures should be as shape agnostic as practical.

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

What is Eisenhower’s matrix?

A

Matrix highlighting importance versus urgency.

  1. Urgent and important
  2. Not urgent and important
  3. Urgent and not important
  4. Not urgent and not important

The behavior of software is urgent but not always important. Architecture is important but never urgent.

The behavior of code occupies the first and third positions, but the mistake project leaders and developers make is to elevate the third position features to first. This failure leads to ignoring the important architecture of the system in favor of the unimportant features of the system.

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

How are software development like science in relation to tests?

A

Tests shows the presence, not the absence of bugs. A program can be proven incorrect by a test, but it cannot be proven correct. Testing deems a program correct enough for our purpose.

Similar to scientific theories since they are falsifiable but not provable.

It is the ability to create falsifiable units of programming that make structured programming valuable today.

Software architects strive to define modules, components and services that are easily falsifiable.

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

What is polymorphism at its core?

A

An application of pointers to functions. The problem with explicitly using pointers to functions to create polymorphic behavior is that pointers to functions are dangerous. This difficulty is solved by OO languages my making it trivial to create polymorphic behavior.

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

What does polymorphism provide?

A

Control over the direction of all source code dependencies. We can invert dependencies such that modules can call into other modules without mentioning anything specific, this provides independent deployability and development.

This is also very important for creating testable programs.

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

Why is immutability interesting to architects?

A

All concurrency issues we face, race conditions, deadlocks and concurrent update problems are due to mutable state. With immutable objects we will not face any problems related to concurrency.

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

What is segregation of mutability?

A

Segregation of the application or services into mutable and immutable components.

Since mutating state exposes the mutable components various problems, it is common practice to use some kind of transactional memory to protect the mutable variables from concurrent updates and race conditions.

Architects would be wise to push as much processing as possible into the immutable components, and drive as much code as possible out of those components that must allow mutation.

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

What is event sourcing?

A

More ram and faster processing speeds equals less reason to use mutable state. Event sourcing stores transactions and current state is retrieved by calculating all these transactions. We can optimize this a bit by calculating a starting point state every midnight.

Transactions are never deleted we only ever use create or read. Hence systems become entirely functional.

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

What do the SOLID principles tell us?

A

They tell us how to arrange our functions and data structures into classes and how those classes should be interconnected. The SOLID principles apply to groupings of functions and data not just OOP classes.

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

What are the goal of the SOLID principles?

A

To create mid-level software structures that:

  1. Tolerate change
  2. Are easy to understand
  3. Are the basis components that can be used in many software systems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the SOLID principles?

A

S (SRP, the single responsibility principles): Each software modules should only have one reason to change.

O (OCP, the open-close principle): For software systems to be easy to change, they must be designed to allow the behavior of those systems to be changed by adding new code, rather than changing existing code.

L (LSP, the Liskov substitution principle): To build software systems from interchangeable parts, those parts must adhere to a contract that allows those parts to be substituted one for another. Objects of a superclass shall be replaceable with objects of its subclasses without breaking the application. That means you can implement less restrictive validation rules, but you are not allowed to enforce stricter ones in your subclass.

I (ISP, the interface segregation principle): Do not depend on things we do not use.

D (DIP, the dependency inversion principle): The code that implements high-level policy should not depend on the code that implements low-level details. Rather details should depend on policy.

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

What is the single responsibility principle?

A

SRP is about functions and classes - but it reappears in a different from at two more levels. At the level of components, it becomes the common closure principle. At the level of architecture it becomes the Axis of Change responsible for the creation of Architectural Boundaries.

A module should have one and only one reason to change. Or a module should be responsible to one and only one actor (group of users or stakeholders).

Problems can occur when we put code that different actors depend on into close proximity. The SRP says to separate the code that different actors depend on.

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

What is the Common Closure Principle?

A

It states classes which are close to the same type of change should be put in the same component. In other words, classes which change because of the same reason and at the same time belong to the same component. Vice versa, classes which change because of different reasons and at different times should be in different components.

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

What is the open-closed principle?

A

A software artifact should be open for extension but closed for modification. If extensions to the requirements force massive changes to the software, then the architects of that software system have engaged in a spectacular failure.

OCP at the architectural level works by separating functionality based on how, why and when it changes, and then organize that separated functionality into a hierarchy of components. Higher-level components are protected from the changes made to lower-level components.

Note, transitive dependencies are a violation of the general principle that software entities should not depend on things they do not directly use.

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

What is the Liskov substitution principle?

A

LSP has morphed into a broader principle of software design that pertains to interfaces and implementations, in relation to its early days where it mostly concerned inheritance.

A simple violation of substitutability can cause a system’s architecture to be polluted with a significant amount of extra mechanisms.

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

What is the interface segregation principle?

A

ISP in architecture refers to the dangers of depending on modules that contain more than we need. Depending on something that carries baggage that we do not need can cause troubles we did not expect.

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

What is the dependency inversion principle?

A

DIP tell us that the most flexible systems are those in which source code dependencies refer only to abstractions and not concretions.

We tend to ignore the stable background and platform facilities when it comes to DIP since these classes/modules rarely change. It is volatile concrete elements we want to avoid depending on.

Good software designers and architects work hard to reduce the volatility of interfaces. Stable architectures are those that favor the use of stable abstract interfaces.

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

What implications comes with DIP?

A
  • Do not refer to volatile concrete classes. Refer to abstract interfaces instead.
  • Do not derive from volatile concrete classes
  • Do not override concrete functions
  • Never mention the name of anything concrete and volatile.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is an architectural boundary?

A

It separates the abstract from the concrete.

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

What are components?

A

They are units of deployment. They are the smallest entities that can be deployed as part of of a system.

Components can be linked together in a single executable, they can be aggregated into a single archive such as a .war file. Or they can be independently deployed as separate dynamically loaded plugins such as .jar or .dll.

They always retain the ability to be independently deployable and therefore independently developable.

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

What is the Reuse/Release Equivalence Principle?

A

The granule of reuse is the granule of release. People who want to reuse software components cannot, and will not, do so unless those components are tracked through a release process and are given release numbers.

Ensures compatible components and developers can also choose based on additions to a new release when and whether to integrate a new release.

Classes and modules that are grouped together into a component should be releasable together.

27
Q

What is the Common Closure Principle?

A

Gather into components those classes that change for the same reason and at the same time. Separate into different components those classes that change at different times and for different reasons.

This is SRP for components.

For most applications, maintainability is more important than reusability. If the code in an application must change, we would rather that all of the changes occur in one component, rather than being distributed across many components.

28
Q

What is the Common Reuse Principle?

A

Do not force users of a component to depend on things they do not need.

Classes and modules that tend to be reused together belong in the same component.

Classes that are not tightly bound should not be together in the same component.

29
Q

What is the tension diagram for component cohesion?

A

The three cohesion principles tend to fight each other. REP and CCP are inclusive principles while CRP is an exclusive principle. It is the tension between these principles that good architects seek to resolve.

Focus too much on REP and CRP will cause too many components are impacted when simple changes are made. Focus too strongly on CCP and REP will cause too many unneeded releases to be generated.

Early in the development of project, the CCP is much more important than the REP, because developability is more important than reuse. As the project matures and more projects draw from it, REP and CRP become more important.

30
Q

What are the consequences associated with the tensions for component for cohesion?

A

REP and CCP - too many unneeded releases
REP and CRP - too many components change when requirements are updated
CRP and CCP - hard to reuse

31
Q

What is the acyclic dependencies principle?

A

Allow no cycles in the component dependency graph.

There are two primary mechanisms for breaking the cycle:

  1. Apply dependency inversion.
  2. Create a new component that break the cycle.
32
Q

What is the stable dependencies principle?

A

Depend in the direction of stability. Any component that we expect to be volatile should not be depended on by a component that is difficult to change.

33
Q

What make a software component hard to change?

A

Size, complexity, clarity and have a lot of other software components depend on it.

34
Q

How can we measure the stability of a component?

A

One way is to count the number of dependencies that enter and leave that component.

35
Q

What is the stable abstraction principle?

A

A component should be as abstract as it is stable.

Some software in the system should not change very often. The software that encapsulates the high-level policies of the system should be placed into stable components.

36
Q

How can a component that is maximally stable be flexible enough to withstand change?

A

OCP. This principle tells us that is desirable to create classes that are flexible enough to be extended without requiring modification.

A stable component should also be abstract so that stability does not prevent it from being extended. On the other hand it says that an unstable component should be concrete since its instability allows the concrete code within it to be easily changed.

37
Q

What is the architecture of a software system?

A

It is the shape given to that system by those who build it. Division of components, arrangement of those components and the ways those components communicate with each other. The strategy behind that facilitation is to leave as many options open as possible for as long as possible.

The primary purpose of architecture is to support the life cycle of the system. The ultimate goal is to minimize the lifetime cost of the system and to maximize programmer productivity.

38
Q

What role does deployment play in software architecture?

A

To be effective, a software system must be deployable. A goal of software architecture is to make a system that can easily be deployed with a single action.

For example microservices might make the system more developable, but configuring a lot of services, can be very difficult from a deployable perspective and should therefore also be considered before making architectural decisions.

39
Q

What is the primary cost of maintenance?

A

Spelunking and risk. Spelunking is the cost of digging through the existing software. And risk are the cost of making changes to an existing system.

40
Q

What do good architects do?

A

Carefully separate details from policy, and then decouple policy from the details thoroughly that the policy has no knowledge of the details and does not depend on the details in any way. Design policy so that decisions about the details can be delayed and deferred for as long as possible.

A good architect makes the system easy to change, in all the ways that it must change, by leaving options open.

41
Q

What changes for different reasons?

A

User interfaces change for reasons that have nothing to do with business rules.

Business rules themselves may be closely tied to the application, or they may be more general and tied to the domain.

The database, query language and even the schema are technical details that have nothing to do with business rules or the UI. And should be separated and independent from the rest of the system.

42
Q

What is true duplication vs false duplication?

A

True duplication is where every change to one instance necessitates the same change to every duplicated instance.

False duplication are instances that seem similar but the code evolve at different rates and for different reasons. This is often key to keeping layers decoupled for example viewmodels or dto objects.

43
Q

What are the modes of decoupling (levels of decoupling)?

A

Source level: control dependencies between source code modules so that changes to one module do not force changes to other modules. (Monolithic structure).

Deployment level: We can control dependencies between deployable units such as dlls and jars. May live in the same address space or as a different process

Service level: dependencies are reduced to data structures and communication is done solely via network packets (e.g. micro-services).

44
Q

What maximizes the people-resources required to build and maintain a software system?

A

Coupling to premature decisions. The types of decisions that have nothing to do with the business requirements and use cases. Databases, frameworks, web servers etc.

45
Q

How do we draw boundary lines in software architecture?

A

We first partition the system into components. Some of those components are core business rules; others are plugins that contain necessary functions not directly linked to the core business rules. We arrange those components such that arrows point towards the core business rules.

46
Q

What are business rules?

A

Business rules are the reason a software system exists. They are the core functionality. The business rules should remain pristine and not concerned with UI, databases etc. The business rules should be the most independent and resuable code in the system.

47
Q

What characteristics do good architectures share?

A
  1. Independent of framework: libraries do not matter
  2. Testable: the business rules can be tested
  3. Independent of the UI: the UI can change easily without changing the rest of the system.
  4. Independent of the database: business rules are not bound to the database.
  5. Independent of any external agency: business rules do not know anything about the interfaces to the outside world.
48
Q

What is the dependency rule?

A

Source code dependencies must point only inward, toward higher-level policies.

49
Q

What are entities?

A

Encapsulate enterprise-wide critical business rules. An entity can be an object with methods, or it can be a set of data structures. They encapsulate the most general and high-level rules.

50
Q

What are use cases?

A

The software in this layer contains application-specific business rules. Use cases orchestrate the flow of data to and from the entities.

51
Q

What are interface adapters?

A

A set of adapters that convert data from the format most convenient for the use cases and entities, to the format most convenient for some external agency such as the database or the web. The whole MVC architecture is an interface adapter.

52
Q

How do we cross boundaries between layers?

A

With dependency inversion, polymorphism etc.

53
Q

What is the humble object pattern?

A

Split behaviors into two modules or classes. One of those modules is humble; contains all the hard-to-test behavior stripped down to bear minimum. They other module contains all the testable behaviors.

The use of this pattern at architectural boundaries vastly increases the testability of the entire system.

54
Q

Why are partial boundaries useful?

A

Full-fledged architectural boundaries are expensive they require polymorphic boundary interfaces, input and output data structures and all of the dependency management necessary to isolate the two sides into independent modules.

Architects might say frick YAGNI (you are not going to need it) and say” maybe i will”. In those cases i can make sense to implement a partial boundary.

55
Q

What is a partial boundary?

A

We do all the work necessary but keep them in the same component. It still requires a lot of work but does not require the administration of multiple components. No version control or release management burden etc.

56
Q

What is a main component?

A

The component that creates, coordinates and oversees the others. It sets up the initial conditions and configuration, gathers outside resources and then hands control over to the high-level policy.

57
Q

What are some reasons service-oriented architectures have become popular?

A
  1. Strongly decoupled from each other

2. Services support independence of development and deployment.

58
Q

What is the decoupling fallacy in service architecture?

A

Services are strongly decoupled because they run in different places. This is a fallacy since services can still be coupled by the resources and data they use. If a field changes in a service, then a similar change might have to propagate into different services, if they are coupled inefficiently.

59
Q

What is the fallacy of independent development and deployment in service architecture?

A

The decoupling fallacy means that services cannot always be independently deployed, developed and operated.

60
Q

What is a vulnerability of functional decomposition in a service architecture?

A

Features that cut across all/many functional concerns. The new feature has to be coordinated across many different services that are potentially maintained and developed by different teams.

61
Q

What are some consequences of systems where tests are not an integrated part of the design?

A

The system becomes fragile, rigid and difficult to change.

62
Q

What is the fragile tests problem?

A

Tests that are strongly coupled to the system must change along with the system. Changes to common system components can cause many coupled tests to break or require change.

63
Q

What is a consequence of the fragile tests problem?

A

The system become rigid. Developers may feel that implementing a new feature or change to the system is unnecessary if it breaks many test cases.

64
Q

What is the first rule of software design (also relevant for designing for testability)?

A

Do not depend on volatile things.