I read a book ( i actually read a lot of books ! )
this book explain some good practices in Oriented Object,
I founded those good practices nice and i’ll try to apply them in my programming projects.
1# Variables Name
- The variables names have to be readable !
If you are programming in a 10 programmers team … giving names like
x=1; y=0;
why ?
imagine the next programmer who have to read again your work !
- Don’t give names with prefixes like
Imagine this in your program
int iCount=0;
double dPersonal=1;
Why?
Because, if you use Eclipse or any other completion program you’ll have all the variables name with de prefix …
and you waste time to search your variable !
- Use nice names
Imagine a code like this one
int dmy;
int smh;
Why?
because nobody knows the signification !
Day Month Year = dym … Wtf ?
it’ll be better to use DayMonthYear;
and SecondMinutHour; to give names for your variables !
it’s actually a little bit longer but … when people are reading you’r programming part … they just understand everything
- Dont Make jokes in your code !
why?
Only people who have the same humour as you will understand what you’r speaking about !
all the other people … will waste time on you’r coding part !
2# Classes
- Class length ?
The length of a class has to be short !
the “good” length of a class is 40 lines …( this is theoretical a thing )
3# Functions / Methods
- Function Length ?
We have to remeber that a function has also to be short !
- A function as only one function ?
this is very important !!
A function have to have only one function …
you cannot make a lot of things in a function
i don’t have any examples yet … but i’ll show more later here !
Posted in Java, Programmation