Decoupling Flashcards

1
Q

What are some elements used in networking to make it as decoupled as possible?

A
  • MessageHandler interface
  • Communicator interface
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does MessageHandler aid in decoupling?

A

It allows the existance of multiple handling possibilities for the messages. This way networking is decoupled from the functionality of handling a message.

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

How does Communicator aid in decoupling?

A

Allows the MessageHandler implementation to use a communicator instead of a client. This way the functionality of handling a message is decoupled from networking.

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

What does synchronous mean in this context?

A

Sth is synchrounous when it executes only one thing at a time.

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

What does blocking mean in this context?

A

Whenever you call a method,
your program will only continue after that method has fully completed its operations/computations.

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

What is mocking used for?

A

To fake the functionality of dependencies that would be too complicated to create. Any class or interface can be mocked.

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

How does mocking work?

A

Essentially mocking a class/interface mean creating a stub implementation. The created object and the associated methods can be used without actually providing an implementation.

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

How to use mocking for a method that returns something?

A

You have to specify what the mocked object should return by using the when().thenReturn(); method

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

What is busy waiting?

A

ex: while(!operationComplete)) Note that there is no body to this while loop. Busy waiting is a process synchronization technique in which a process/task waits and constantly checks for a condition to be satisfied before proceeding with its execution. It is not ideal because we are wasting CPU cycles by continuously checking whether the condition is true.

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

How can busy waiting be prevented?

A

By using awaitility. It doesn’t suffer from busy waiting since it will only periodically check for the condition.

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

What is the difference between verify method and thenReturn method in mocking?

A

The verify method checks if the specific method was called at all while the thenReturn method allows us to check the behavior of a method by checking if it returns as expected.

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

What is the Corrective Software Maintenance and what is the order in which the phases happen?

A

This type of maintenance corrects the defects, errors, faults and the order is: implement, test, release.

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

What is the Perfective Software Maintenance and what is the order in which the phases happen?

A

This type of maintenance adds features to improve features for user experience and the order is: requirements, design, implement, test, release.

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

What is the Adaptive Software Maintenance and what is the order in which the phases happen?

A

This type responds to changes in environment/context. The order is: design, implement, test, release

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

What is the Preventive Software Maintenance and what is the order in which the phases happen?

A

This type improves software to reduce risk of deterioration. The order is: design, implement, test, release.

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

What is refactoring?

A

It is a change in the code that improves readability, structure, efficiency, flexibility without changing the functionality.

17
Q

What are the code smells?

A

“Smells are surface indications that usually corresponds to a deeper problem in the system.” They are things that are 1)quick to spot 2)smells do not always indicate a problem

18
Q

What does shotgun surgery refer code smell to and how can you refactor that?

A

Change it one class leads to changes multiple other classes. You can move method/ move field/ combine functions into class/ incline class or method

19
Q

What does the feature envy smell refer to?

A

Method uses another object’s data more than its own. To refactor it, you can move the method or extract method.

20
Q

What does the data class smell refer to?

A

Classes with fields but without behavior (no other methods but getters and setters)