Best coding
practices
Programming	workshop
NO best language out there
BestProgrammingLanguageFor.me
NO best language out there
BestProgrammingLanguageFor.me
Where to write
Text	Editor
Where to write
Text	Editor
IDE
Java / Android -- Intellij IDEA
Python -- PyCharm
C / C++ -- Clion
Obj. C / Swift -- App Code
C# -- ReSharper / Rider
Php -- PhpStorm
Ruby -- RubyMine
Javascript -- WebStorm
DBA -- DataGrip
JetBrains student	program
jetbrains.com/student
How to manage :: VCS
How to manage :: VCS
The	most	important	rule
Always code as if the guy who ends up
maintaining your code will be a violent
psychopath who knows where you live.
Remember the second law of thermodynamics?
It implies that disorder in a system will always
increase unless you spend energy and work to
keep it from increasing.
It is hard to write clean code
Reinventing the wheel
Software design patterns
Design patterns can speed up the development process
by providing tested, proven development paradigms.
Effective software design requires considering issues that
may not become visible until later in the implementation.
Reusing design patterns helps to prevent subtle issues
that can cause major problems and improves code
readability for coders and architects familiar with the
patterns.
Creational
Creational	design	patterns	are	design	patterns	that	deal	with	object	creation	
mechanisms,	trying	to	create	objects	in	a	manner	suitable	to	the	situation.	The	basic	
form	of	object	creation	could	result	in	design	problems	or	added	complexity	to	the	
design.	Creational	design	patterns	solve	this	problem	by	somehow	controlling	this	
object	creation.
Software design patterns
Software design patterns
Creational
Structural
Structural	Design	Patterns	are	Design	Patterns	that	ease	the	design	by	identifying	a	
simple	way	to	realize	relationships	between	entities.
Software design patterns
Creational
Structural
Behavioral
Behavioral	design	patterns	are	design	patterns	that	identify	common	communication	
patterns	between	objects	and	realize	these	patterns.	By	doing	so,	these	patterns	
increase	flexibility	in	carrying	out	this	communication.
Variable	and	method	naming
1. Use	intention-revealing	name
Variable	and	method	naming
1. Use	intention-revealing	name
2. Use	pronounceable	name
Variable	and	method	naming
1. Use	intention-revealing	name
2. Use	pronounceable	name
3. Don't	be	cute
Variable	and	method	naming
1. Use	intention-revealing	name
2. Use	pronounceable	name
3. Don't	be	cute	
4. Use	one	word	per	concept
Variable	and	method	naming
1. Use	intention-revealing	name
2. Use	pronounceable	name
3. Don't	be	cute	
4. Use	one	word	per	concept
5. Use	verbs	for	function	names	and	nouns	for	classes	and	
attributes
Variable	and	method	naming
1. Use	intention-revealing	name
2. Use	pronounceable	name
3. Don't	be	cute	
4. Use	one	word	per	concept
5. Use	verbs	for	function	names	and	nouns	for	classes	and	
attributes
Functions
1. The	smaller,	the	better	(but	don’t	be	crazy)
Functions
1. The	smaller,	the	better
2. The	function	shall	do	only	one	thing
Functions
1. The	smaller,	the	better
2. The	function	shall	do	only	one	thing
3. Less	arguments	are	better
Functions
1. The	smaller,	the	better
2. The	function	shall	do	only	one	thing
3. Less	arguments	are	better
4. No	side	effects
Functions
1. The	smaller,	the	better
2. The	function	shall	do	only	one	thing
3. Less	arguments	are	better
4. No	side	effects
5. Avoid	output	arguments
Functions
1. The	smaller,	the	better
2. The	function	shall	do	only	one	thing
3. Less	arguments	are	better
4. No	side	effects
5. Avoid	output	arguments
6. Don’t	repeat	yourself
Commets
Commets
1. Don’t	comment	bad	code,	rewrite	it
Commets
1. Don’t	comment	bad	code,	rewrite	it
2. If	code	is	readable	you	don’t	need	comments
Commets
1. Don’t	comment	bad	code,	rewrite	it
2. If	code	is	readable	you	don’t	need	comments
3. Explain	your	intention	in	comments
Commets
1. Don’t	comment	bad	code,	rewrite	it
2. If	code	is	readable	you	don’t	need	comments
3. Explain	your	intention	in	comments
4. Warn	of	consequences	in	comments
Commets
1. Don’t	comment	bad	code,	rewrite	it
2. If	code	is	readable	you	don’t	need	comments
3. Explain	your	intention	in	comments
4. Warn	of	consequences	in	comments
5. Emphasize	important	points	in	comments
Commets
1. Don’t	comment	bad	code,	rewrite	it
2. If	code	is	readable	you	don’t	need	comments
3. Explain	your	intention	in	comments
4. Warn	of	consequences	in	comments
5. Emphasize	important	points	in	comments
6. Noise	comments	are	bad
DEMO	TIME!
github.com/aganezov/python-samples
Next	meeting	of	JetBrains GWU
March	24th,	2016
Lehman	Auditorium	(B1270)
5:00	– 7:00	pm
“Mastering	Python”
Facebook	
https://www.facebook.com/groups/jetbrains.gwu/
Email	
jetbrains.gwu@gmail.com
aganezov@gwu.edu

Best coding practices