Clean Code: Avoid Too Many Arguments In Functions

Clean Code: Avoid Too Many Arguments In Functions

How many arguments is too many for a function?

We can agree that a function with zero arguments is a good function, we don’t have to worry too much about it. The perfect world will be if all functions have zero arguments, but we know that’s not possible. Sometimes we’ll end up writing function containing six or more arguments, like this function:

What Makes Good Unit Test? Readability

What Makes Good Unit Test? Readability

How readability can make good unit tests.

The code that we write is more read than written. We write the code once, and it’s read many times more. Because of this, we need to write code that the reader could understand. We should care about the unit test’s code quality as much as we care for our production code. In this series’ last installment I’m going to talk about how we can write more readable unit tests.

Design Patterns and Practices in .Net: Fluent Builder Test Pattern

Design Patterns and Practices in .Net: Fluent Builder Test Pattern

Making cleaner switch statements.

The unit test’s arrange phase is where we write more code. Coding data creation can be cumbersome. The worst scenario happen when we have to fill all class’ properties, even though, we’re only using one property in the test. Besides being tedious, the data creation process can have a lot of code, resulting in less readable and maintainable tests.

Pagination


© 2021. All rights reserved.

Powered by Hydejack v9.1.6