Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

The Best Practice

Programing
“Good programming practices and
techniques can be applied in many
different environments and types of
systems, but coding is just one of the
things that modern developers do.”
Sandro Mancuso, The Software Craftsman.
Ch. A new Reality. At page 36

Raúl .A Alzate | Best Practice Programing


First steps
● Katas
● Cyber Dojo
● Pet Projects
● Open Source
● Pair Programming

Training: the action of undertaking a course of


exercise and diet in preparation for a sporting
event.

Raúl .A Alzate | Best Practice Programing


Refactoring
Testing
SOLID
Code
Smell
Debugger

Clean
Code
KISS
Design TDD
Simple
Raúl .A Alzate | Best Practice Programing
It's only I'll show you
3 steps the first thing
you should do

Raúl .A Alzate | Best Practice Programing


1. Identify the Code
Smell
● Bloaters
● Object-Orientation Abusers
● Change Preventers
● Dispensables
● Couplers

Raúl .A Alzate | Best Practice Programing


2. Apply some
refactoring techniques
● Composing Methods
● Moving Features between
Objects
● Organizing Data
● Simplifying Conditional
Expressions
● Simplifying Method Calls
● Dealing with Generalization

Raúl .A Alzate | Best Practice Programing


3. Review your Code
● Your code must be understood
by another programmed.
● It must not have duplicate code.
● Contain a minimum number of
classes and other parts.
● Pass all the tests.
● It is easier and cheaper to
maintain!
● If the above is not right, return
to the previous step.

Raúl .A Alzate | Best Practice Programing


Practice, Practice, Practice
Object Calisthenics
Programming exercises
9 rules
9 rules
1. Only One Level Of Indentation Per Method
2. Don’t Use The ELSE Keyword
3. Wrap All Primitives And Strings
4. First Class Collections
5. One Dot Per Line
6. Don’t Abbreviate
7. Keep All Entities Small
8. No Classes With More Than Two Instance
Variables
9. No Getters/Setters/Properties

Raúl .A Alzate | Best Practice Programing


1. Only One Level Of Indentation Per Method

Raúl .A Alzate | Best Practice Programing


2. Don’t Use The ELSE Keyword

Raúl .A Alzate | Best Practice Programing


3. Wrap All Primitives And String

Encapsulate all the primitives


within objects

Raúl .A Alzate | Best Practice Programing


4. First Class Collections

Any class that contains a


collection should contain no
other member variables

Raúl .A Alzate | Best Practice Programing


5. One Dot Per Line

You should not chain method calls

Raúl .A Alzate | Best Practice Programing


6. Don’t Abbreviate

Why Do You Want To Abbreviate?

Raúl .A Alzate | Best Practice Programing


7. Keep All Entities Small

Long files are harder to read

Raúl .A Alzate | Best Practice Programing


8. No Classes With More Than Two Instance
Variables

high cohesion,
and better encapsulation.

Maintain the state of a single instance


variable
Raúl .A Alzate | Best Practice Programing
9. No Getters/Setters/Properties

Raúl .A Alzate | Best Practice Programing


The Best Practice
Programing
End...

You might also like