Clean Code Words Flashcards

1
Q

DRY

A

Don’t repeat youself.

If you need to copy code create a function for it.

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

KISS

A

Keep it simple stupid.

Create functions/classes as simple as possible

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

Beware of Premature Optimization

A

Optimize only when its necessary and required.

Rules of Optimization:
Rule 1: Don’t do it.
Rule 2 (for experts only): Don’t do it yet.

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

FCoI

A

Favour Composition over Inheritance

„Because inheritance exposes a subclass to details of its parent’s implementation, it’s often said that ‚inheritance breaks encapsulation„. (Gang of Four 1995:19)

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

IOSP

A

Integration Operation Segregation Principle

IOSP uses a clear separation for function logic.

  • A method (called Operation) contains only logic Transformationen, Controllstructures, I/O- or API-calls.
  • A method (called Integration) contains no logic only method calls of the same code base
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Boy Scout Rule

A

Every time you work on some code it may get a little bit better. Without bureaucratic planning.

Clean code developers leave code in a better state than they found it. So after work accomplished code shall apply more to CCD values than before.

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

Root Cause Analysis

A

knowing the root cause, clean-up tends to be less effert than curing symptoms

Root Cause Analysis is also known as “Five Why’s”.
This term origins from the Toyota Production System (TPS) stating the basic idea to ask “Why?” five times.

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

Version Control

A

Being afraid of damaging a running system paralyzes software development. Using version control that fear is obsolete and development can progress quickly and bravely.

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

Simple Refactoring Patterns

A

Improving code is easier if you know typical improvement patterns. Their usage scenarios sensitize for weaknesses in self-written code. As accepted patterns they encourage to be applied.

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

Daily Reflection

A

There is no improvement, no progress, no learning without Reflection. But only if reflection is on the schedule, it will happen under daily business pressure.

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

SLA

A

Single Level of Abstraction

Within one method you should use only one level of abstraction. Otherwise the reader will find it hard to differentiate essentials from details. So if you need to fiddle with bits, don’t combine it with method calls.

Lines of code may have different levels of abstraction. Assigning a value to a variable is on a lower level than let’s say a method call.

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

SRP

A

Single Responsibility Principle

A class having exactly one task is easier to understand than a convenience store

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

SoC

A

Separation of Concerns

If a code unit does not have a clear purpose, it will be difficult to understand, difficult to use, difficult to enhance and difficult to correct.

You should not combine multiple concerns in one class. What is a concern?
Concerns a “completely different” purposes.
Concern are considered to be orthogonal to each other and especially orthogonal to the main functionality of a functional unit. Samples for typical concerns are: Tracing, logging, transaction handling, caching. If you follow SoC principle, you will extract these concerns into specialized functional units.

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

Source Code Conventions

A

Code is more frequently read than written. Accordingly conventions are important to support reading and conceive code quickly.

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

Issue Tracking

A

Only written issues are not forgotten and can be efficiently followed-up or delegated.

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

Automatized Integration Tests

A

Integration tests ensure the code does what it shall do

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

Read, Read, Read

A

Reading educates!

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

Reviews

A

Four eyes will see more than two eyes. Explaining own code to a fellow developer frequently reveals details which were not considered yet.

19
Q

ISP

A

Interface Segregation Principle

It states that a client shall not depend on service details which the client does not use. The leaner the service interface is the smaller is the coupling of both components.

20
Q

DIP

A

Dependency Inversion Principle

Class isolation is a prerequisite for testing to the point. Isolation is when classes receive no more implementation dependencies neither at compile time nor at runtime.
Concrete dependencies shall be decided on as late as possible. Ideally at runtime.

21
Q

LSP

A

Liskov Substitution Principle

Avoid surprises with the heirs if you are familiar with the testator.
It claims that subtypes have to behave like their base type

Generally speaking the principle states that a subtype may only extend base type functionality but must not reduce it. A subtype can keep or extend a value range defined in a base type but never limit it.

22
Q

PoLA

A

Principle of Least Astonishment

If a component behaves surprisingly different than expected, your application will become unnecessarily complex and error prone.

23
Q

IHP

A

Information Hiding Principle

Hiding details in an interface reduces dependencies.

Interface design should consider which details need to be visible to the outside world. “Interface” not only in its object oriented meaning but also implicit interfaces.

24
Q

Automatized Unit Tests

A

Only automatized tests are really executed in a consequent manner. The more accurate unit test verify code the better.

25
Q

Mockups

A

Mockups make controllable tests possible.

26
Q

Code Coverage Analysis

A

Only believe in tests you know they really cover the test area.

27
Q

Attend professional events

A

Discussing regularly to other software developers and exchanging experiences prevents stewing in one’s own juice. To get new views that exchange should happen with developers outside of the team, apart from daily routine, e. g. in user groups.

28
Q

Complex Refactorings

A

It is not possible to write code in an ultimate form.

Dividing simple from complex refactorings make sense because complex refactorings will only be efficient and riskless with automatized tests at hand.

Without tests you wouldn’t know if the code is still correct.

29
Q

Open Closed Principle

A

Keep the risk as low as possible to destabilize a system by adding new features.

Claims to keep a class open for enhancements but closed against modifications

30
Q

Tell, Don’t Ask

A

High cohesion and loose coupling are virtues. Public state details in a class contradict those.

31
Q

Law of Demeter

A

Object dependencies over multiple service chain elements lead to unpleasantly close coupling.

The Law of Demeter is about limiting the interplay of objects to a healthy extent. Simplified it means “Don’t talk to strangers”.

32
Q

Continuous Integration

A

Automatization of centralization of software production increase productivity and reduce risk

33
Q

Metrics

A

Static Code Analysis

Trust, but verify.

34
Q

Inversion of Control Container

A

It is easier to configure things which are not hard-wired.

35
Q

Share Experience

A

Sharing your experience helps others and yourself.

36
Q

Error Measurement

A

You will only be able to reduce the error rate, if you first-hand know how many errors occur and adopt your approach accordingly.

37
Q

Design and Implementation don’t overlap

A

Design papers provide more damage than benefit if they have nothing in common with the implementation. Hence minimize risks for inconsistencies.

38
Q

Implementation reflects Design

A

Implementation deviating from design as you chose leads to no longer maintainable software. Implementation needs a physical frame given by design.

39
Q

YAGNI

A

You Ain’t Gonna Need It

Stuff which not used by anyone has no value. Do not spend any time on it.

40
Q

Continuous Delivery

A

Make sure the product becomes installed correctly.

41
Q

Iterative Development

A

As customer requirements can change software development would be wise to be able to adopt its course.

42
Q

Component Orientation

A

Software needs black-box-building-blocks which can be developed and tested in parallel.

43
Q

Test First

A

Customer is king and defines the shape of a service. Service implementations will fit only well, if these are driven by a client.