Clean Code at . . .

Naming

Styles

Formats

Size of functions

Exception handler

Documentation

Testing

Basic Programming Principles.

DRY

Duplication is a waste.

Adding additional, unnecessary code to a codebase increases the amount of work required to extend and maintain the software in the future.

YAGNI

You Ain’t Gonna Need It

Always implement things when you actually need them, never when you just foresee that you may need them.

  • Clear intent.

  • Use the right tool.

  • Bite-size logic.

  • Sometimes code isn't the answer.

KISS

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

Martin Fowler

SOLID

  • S   Single-responsiblity principle.

  • O  Open-closed principle.

  • L   Liskov substitution principle.

  • I    Interface segregation principle.

  • D  Dependency Inversion principle.

"Getting perfect systems in the first try is a myth."

Robert C. Martin

3 Simple steps to get a better software design.

by Kent Beck

1) Run all the suit of test.

2) Remove duplicates.

3) Be sure to express the programmer's intention.

In Linio we have . . .

A) Standars.

https://github.com/LinioIT/linio-standards

"The construction of standards must be done without forgetting the needs to which the system is directed."

Robert C. Martin

B)  We take care of the format in the code.

VS

C) We give importance to names.

D) Good handling of exceptions.

UNRECOVERABLE

Exception types.

RECOVERABLE

IGNORABLE

E) Good use of comments in the code.

  • Obsolete comments.

  • Wrong written comments.

  • Redundant comments.

  • TODO

  • Document only when it is not expressive in code.

F) Test.

G) Continuous integration.

H) Use of design patterns.

We can improve . . .

1) Self-documentation.

Our brain is a compiler. Only processes 7 items at the same time.

2) Size of functions.

"Simple functions could be long."
 "Complex function should be short."

3) Modularization.

  The modularization and separation facilitates decision making.

4) Remove the use of nested operators.

5)  Reduction of parameters received in a function.

Tools that help us make Clean Code.

We are authors.

Face your creation with pride, devote time to functions and classes, select better names, divide large functions into smaller ones, take care of your work.

"Always leave the code you're editing a little better than you found it."

The Boy Scout rule.

Robert C. Martin

"Always code as if the guy who ends up maintaining your code was a violent psychopath who knows where you live." 

John Woods

Code for readability.

How far should go my obsession with clean code?

Bibliography.

"Clean Code" by Robert Cecil Martin (Uncle Bob)

¡ Thanks for your attention !

Sagrario Meneses
Senior Software Engineer II
@sagmmd

Made with Slides.com