23 recommendations for the readable code

23 recommendations for the readable code  
 
The foreign code is not always clear. A few hours to solve problems that can be fixed in a couple of minutes. In this article, we'll look at the tips for writing clear code that is easy to maintain.
 
 
Note that this is not a guide to writing "clean code". Under this term understand different things. Someone like easily extensible and generic code, someone prefers to abstract the implementation and work only with configs, and some just love the subjectively beautiful code. This manual focuses on readability, that is, on the most efficient transfer of necessary information to other programmers.
 
...
+ 0 -

When testing through the public method begins to stink (example)

In article about testing public methods touched unit testing of private class logic. I think I should rewrite the thesis, since most, in my opinion, perceived that it was about testing specifically private methods, although it was about private logic. In this article I want to illustrate with a practical example the main thesis. Under the cut example with a little analysis.
 
 

Example with a smell of


 
In order to illustrate the problem, I came up with an example. The idea of ​​it is taken from one real project. Ideally, as someone might notice, the class would have to be written differently...[/h]
TDD / .NET
+ 0 -

Testing only through public methods is bad

In programming and in TDD, in particular, there are good principles that are useful to adhere to: DRY and testing through public methods. They have repeatedly proven themselves in practice, but in projects with a large legacy code can have a "dark side". For example, you can write code, guided by these principles, and then discover yourself analyzing tests that span a bunch of 20+ abstractions with a configuration that is incommensurably larger than the tested logic. This "dark side" scares people and inhibits the use of TDD in projects. Under the cut I argue why testing through public methods ...
TDD / C#
+ 0 -

DocDoc returns to Habr

Kind time of the day, Gabrabizhiteli!
 
 
We - the company DocDoc - after a long break decided to continue to blog on those. processes, business processes and production approaches that were able to build within themselves for 6 years of successful existence in the market!
 
 
Our story began with a simple "knee-length" collection of a prototype recording to a doctor and developed into a technology-rich product. Over time, it appeared:
 
 
- BOOKING TO THE DOCTOR (full recording without a call to the clinic)
 
- Robotic record (voximplant helped us)
 
- Full-text search
 
- Advice and comprehensive ...
+ 0 -

What is component tests, and what is the SDET?

Abstract
 
The article talks about an unconventional, but useful form of tests, and also sums up the results of seven years of work in the development of tests.
 
Why do we need component tests?
 
After all, there are, say, unit tests, which test in detail the giblets of components. They thoroughly check that the component works in accordance with the concept of the developer. But often this is a test of "buttons", and not how the suit as a whole sits. And not always the behavior conceived by the programmer, coincides with what the customer wanted.
 
And there are, for example, acceptance tests...
+ +2 -

Software testing: automation, evaluation and utopianity

Last time we they told , how to prove to all participants of the project that testing is a useful thing. We hope that the arguments were convincing. Now you can talk about how to approach the creation and planning of tests, their classification and evaluation.
 
 
Software testing: automation, evaluation and utopianity
 

The pyramid of testing is


 
Effective distribution of tests from the point of view of their automation can be represented in the form of a pyramid.
 
 

 
Most of the functionality of the software is covered by simple modular ...[/h]
+ 0 -