4 Principles To Make Your Code Shine

Do you want your code to shine? Here are 4 principles of good code to help you get there.

1- KISS

Keep it simple : You will not recognise your own code six months from now. Keep it simple, keep it readable. Keep it clear. Don't be clever. Your future self will thank you.

2- DRY

Don't repeat yourself Copy-pasting is a sure sign that things have gone wrong somewhere. Duplicated code needs to be moved to a common place.

3 - YAGNI

You ain't gonna need it. User needs and software specifications are fluid. Don't optimise too early. Don't away abstract concepts on the off chance another similar use case might arise one day. Don’t optimise early. Don’t abstract early.

4 - TDA

Tell don't Ask (a.k.a Separation of Concerns) Business logic should be in one place. "Bits" of code should do one thing only. Keep things separate. Tell your code to do things and then let it manage how to do it and when not to do it.

What do you think: are there any more that are worth mentioning and focusing on?

That’s all folks

Thanks for getting all the way down here. Let me know what you thought of all this newsletter issue so I can better meet your needs!

David from Kodaps

Reply

or to participate.