What are the greatest programming tips and tricks you have learned on your own by years of coding?

Answer by Jerome Terry:

I can't really claim I've learned the following lessons on my own. As the famous Newton quote goes "standing on the shoulders of giants".

I've learned these lessons by hard work, and reading everything I could get my hands on over the course of the last 17 years – 5 years of university, 12 years programming.

These lessons have served me well. Hopefully they are helpful to you as they are to me.

Iterate. Successive refinement is how we get to great code and great products.

Simpler is usually better. Watch Rich Hickey's talk Simple Made Easy, and read Kent Beck's Xp Simplicity Rules.

Don't be clever. Simplicity, Clarity, Generality. Read "The Practice of Programming" by Brian Kernighan and Rob Pike. Speaking of Brian Kernighan, also read "The C Programming Language" by Brian Kernighan and Dennis Ritchie.

SRP and DRY principles go a long way towards clean code. Read "Clean Code" by Uncle Bob (Robert C. Martin)

You ain't gonna need it (YAGNI) applies most of the time. In general, just design for today's requirements, to prevent over engineering. Having said that, sometimes it's necessary to design for future growth. There's a balance – it's up to you to find it.

Code with obviously no bugs is immensely better than code with no obvious bugs.

Being able to reason about your code is paramount to high quality.

Requirements are rarely cast in stone. Question everything. You have the right to ask to have the requirements changed.

Start with why. Watch Simon Sinek's talk How great leaders inspire action

Clients don't really know what they want, and that includes your manager. It's your job to elicit their true needs.

Despite what process you follow, some amount of up front design is required – how much should be proportional to complexity. Read "Domain Driven Design" by Eric Evans.

Design patterns aren't used as much as you'd think. Recognizing common patterns is important. Don't treat patterns as a hammer looking for a nail. Read "Refactoring to Patterns" by Joshua Kerievsky.

SOLID principles are far more important than design patterns. Read Uncle Bob's article Principles Of OOD

Beware of dogma. There's usually more than one way of doing things. Best practice is overused.

No one has it all figured out. Some know more than others. Always try to be the worst member in the band. Read "The Passionate Programmer" by Chad Fowler.

There's no such thing as perfect. You can always be better. "The perfect is the enemy of the good" – Voltaire.

If you don't design for scalability, your code won't scale. If you don't design for security, your code won't be secure. Same applies for all -ilities.

You are not your code. Criticism of your code isn't a criticism of you.

Don't go dark. Share your unfinished work with others willingly. Read "Dynamics of Software Development" by Jim McCarthy

Test your work. Try writing tests before code. Try TDD. Try BDD. Read "Working Effectively with Legacy Code" by Michael Feathers.

Learn multiple paradigms. OOP, Functional, etc. Your OO code will improve after studying functional languages such as Haskell and Lisp.

Watch OOPSLA 97 Keynote by Alan Kay, "The Computer Revolution Hasn't Happened Yet".

Never stop learning. Read as many books as you can, but not only technical books. Read "Zen And The Art of Motorcycle Maintenance" by Robert M. Pirsig.

Read "The Pragmatic Programmer" by Andy Hunt and Dave Thomas.

Read "Code Complete 2" by Steve McConnell

Read SICP. Don't just read it cover to cover. Follow along with a Scheme environment (e.g. Racket) and actually write some code.

Don't ask permission to refactor, test, document etc. It's all part of "programming". Don't ask permission to do your job.

Care about your work. Care about your customers. The code we write allows the users of our code to get their shit done, without our software getting in their way.

Always ask "what problem am I trying to solve"?

In general, stick to solving one problem at a time. When you spot other problems, note them and come back to them later.

Be where you're at. This is a life lesson that applies to software development. When you commit to doing something, focus on doing it. When your washing the dishes focus on washing the dishes – forget all the things that stressed you out that day. If you are spending time with your family, be there – turn off your phone, forget that tough problem you've been wrestling with. When you're in a meeting, participate – focus on the conversation and forget about the work that's piled up. Read "Zen Mind, Beginner's Mind" by Shunryu Suzuki

SRP has broader applications than just to code.

"Premature optimization is the root of all evil" – Donald Knuth. Start with a brute force algorithm until you find a reason to change.

Ask "what's the simplest thing that can possibly work?" Read "eXtreme Programming Explained" by Kent Beck. First version is supposedly more extreme than the second.

Be OK with you. You will never know everything – that is impossible. Keep learning, but don't get caught up on what you don't know. Watch Kent Beck's talk Ease at Work

Be humble. Everyone is at different points of learning in their career. Help others on their path. Ask for help when you need it. Give back to the community. Watch Leon Gersing's talk "Truth, Myth and Reality in Software Development"

Multi-tasking is an illusion. Computers get away with it because they can context switch really fast (most of the time). Context switching for us mere mortals has a high cost. Do one thing at a time, and do it well.

9 women can't have a baby in a month. Read "The Mythical Man Month" by Fred Brooks.

There is no spoon

What are the greatest programming tips and tricks you have learned on your own by years of coding?


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s