39 Best Kept Secrets of Great Programmers _ Quora

3
Quora Become a fan The best answer to any question Posted: 07/16/2015 3:33 pm EDT Updated: 07/16/2015 4:59 pm EDT 39 Best Kept Secrets of Great Programmers What are the best-kept secrets of great programmers?: originally appeared on Quora: The best answer to any question. Ask a question, get a great answer. Learn f rom experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+.  Answer by Jens Rantil , Developer Most of the time, using inheritance is a bad object oriented design in the long run. It reduces reusability and testability of code. Consider using interf aces instead. See No, inheritance is not the way to achieve code reuse!. Related;  Avoi d introducing an interface until you are comfortabl e in your domain. "Premature interfacing" can also lead to design issues down the road. Deep nested code (both intra-function and inter-function) is 1) harder to maintain and 2) more prone to bugs. Estimating time is hard . One reason why Scrum and sprints are used in many places. Proper encryption is hard . Don't invent it yourself unless you have a good reason to. Side-effect free logic is nice. It makes it easier to reason about state (see below) and generally simplifies automated testing. Learn to reason around state and lifecycles. See Jens Rantil's Hideout. Concurrency can be hard  without the right primitives. Threadpools, Queues, Observables, and actors can sometimes help a lot. Premature optimization is the root of all evil. A good general development process is: 1) Get it to work. 2) Make the code beautiful. 3) Optimize. Know your basic data structures and understand time complexity. It's an effective way of making your code much faster without adding complexit y. Practice back-of-the-envelope calculations. How many items will a piece of code generally hold in memory?  Write code as you want to read it. Add comments where you think you will not understand your code in a year's time. You will need the comment in a month. Somewhat related; Setup you build tooling around a project so that it's easy to get started. Document the (few) commands needed to build, run, test and package in a README file. Making sure your projects can build from command line makes things so much easier down the road. Handling 3rd party dependencies in many languages can be a real mess (looking at you Java and Python). Specifically when two 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. Featuring fresh takes and real-time analysis from HuffPost's signature lineup of contributors Gary Hart Mark Ruffalo Bernard- Henri vy Kirk Douglas HOT ON THE BLOG July 17, 2015 iOS app Androi d app More  Desktop Alerts Log in Create Account

Transcript of 39 Best Kept Secrets of Great Programmers _ Quora

7/23/2019 39 Best Kept Secrets of Great Programmers _ Quora

http://slidepdf.com/reader/full/39-best-kept-secrets-of-great-programmersquora 1/3

Quora Become a fan

The best answer to any question

Posted: 07/16/2015 3:33 pm EDT Updated: 07/16/2015 4:59 pm EDT

39 Best Kept Secrets of Great Programmers

What are the best-kept secrets of great programmers?: originally appeared on Quora: The best answer to any question. Ask a question

get a great answer. Learn f rom experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+.

Answer by Jens Rantil , Developer

Most of the time, using inheritance is a bad object oriented design in the long run. It reduces reusability and testability of code

Consider using interf aces instead. See No, inheritance is not the way to achieve code reuse!. Related;

Avoid introducing an interface until you are comfortable in your domain. "Premature interfacing" can also lead to design issues dow

the road.

Deep nested code (both intra-function and inter-function) is 1) harder to maintain and 2) more prone to bugs.

Estimating time is hard . One reason why Scrum and sprints are used in many places.

Proper encryption is hard . Don't invent it yourself unless you have a good reason to.

Side-effect free logic is nice. It makes it easier to reason about state (see below) and generally simplifies automated testing.

Learn to reason around state and lifecycles. See Jens Rantil's Hideout.

Concurrency can be hard without the right primitives. Threadpools, Queues, Observables, and actors can sometimes help a lot.

Premature optimization is the root of all evil. A good general development process is: 1) Get it to work. 2) Make the code beautiful. 3

Optimize.

Know your basic data structures and understand time complexity. It's an effective way of making your code much faster withou

adding complexity.

Practice back-of-the-envelope calculations. How many items will a piece of code generally hold in memory?

Write code as you want to read it. Add comments where you think you will not understand your code in a year's time. You will nee

the comment in a month. Somewhat related;

Setup you build tooling around a project so that it's easy to get started. Document the (few) commands needed to build, run, test and

package in a README file.

Making sure your projects can build from command line makes things so much easier down the road.

Handling 3rd party dependencies in many languages can be a real mess (looking at you Java and Python). Specifically when two

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

15.

Featuring fresh takes and real-time analysis fromHuffPost's signature lineup of contributors

Gary Hart Mark Ruffalo

Bernard-Henri Lévy Ki rk Douglas

HOT ON THE BLOG

July 17, 2015

iOS app Android app More Desktop Alerts Log in Create Acc

7/23/2019 39 Best Kept Secrets of Great Programmers _ Quora

http://slidepdf.com/reader/full/39-best-kept-secrets-of-great-programmersquora 2/3

different libraries depend on different versions. Some key things to take away from this: 1) Constantly question your dependencies. 2

Automated tests can help aga inst this. 3) Always fixate which version of a 3rd party dependency you should use.

Popular Open Source projects are a great way to learn about good maintainable code and software development process.

Every single line you add to an application adds complexity and makes it more likely to have bugs. Removing code is a great way to

remove bugs.

Code paths that handles failures are rarely tested/executed (for a reason). This makes them a good candidate for bugs.

Input validation is not just useful for security reasons. It helps you catch bugs early.

Somewhat related to above: State validation and output validation can be equally useful as input validation, both in terms odiscovering inherent bugs, but also for security sensitive code.

Code reviews are a great way to improve as a programmer. You will get critique on your code, and you will learn to describe in word

why someone else's code is good or bad. It also trains you to discover common mistakes.

Learning a new programming language is a great way to learn about new paradigms and question old habits.

Always specify encoding when converting text to and from bytes; be it when reading/writing to network, file or for encryption

purposes. If you rely on your locale's character set you are bound to run into data corruption eventually. Use a UTF character set i

you can get to choose yourself.

Know your tools; That includes your editor, the terminal, version control system (such as git) and build tooling.

Learn to use your tools without a mouse. Learn as many keyboard shortcuts as possible. It will make you more efficient and igenerally more ergonomic.

Reusing code is not an end goal and will not make your code more maintainable per se. Reuse complicated code and be aware tha

reusing code between two different domains might make them depend on each other more than necessary.

Sitting for long time by the computer can break your body. 1) Listen to what your body has to say. Think extra about your back, neck

and wrists. Take breaks if your body starts to hurt. Creating a pause habit (making tea, grabing coffee) can surprisingly be good fo

your body and mind. 2) Rest your eyes from time to time by looking away from your screen. 3) Get a good keyboard without awkwar

wrist movements.

Automated testing, and in particular unit tests, are not just testing that your code does was it should. They also 1) document how th

code is supposed to be used and 2) also helps you put yourself in the shoes of someone who will be using the code. The latter is why

some claim test-first approach to development can yield cleaner APIs.

Test what needs to be tested. Undertesting can slow you down because of bug hunting. Overtesting can slow you down because every

change requires updating too many tests.

Dynamic languages generally need more testing to assert they work properly than compiled languages. (Offline code analysis tool

can also help.)

Race conditions are surprisingly more common than one generally thinks. This is because a computer generally has more TPS than w

are used to.

Understanding the relationship between throughput and latency can be very useful when your systems are being optimized. Related;

Many times high throughput can be achieved by introducing smart batching.

Commit your code in small, working, chunks.

Keep your version control system's branches short-lived. My experience is that risk of failures increases exponentially the longer a

branch lives. Avoid working on a branch for more than two weeks. For large features, break them into multiple refactoring branches t

make the feature easier to implement in a few commits.

Know your production environment and think about deployment strategies for your change as early as possible.

Surprisingly, shipping code more frequently tends to reduce risk, not increase it.

Learning an object oriented language is easy. Mastering good object oriented design is hard. Knowing about SOLID and object

oriented Design Patterns will improve your understanding of OO design.

It's possible to write crappy code in a well architected system. However, in a well architected system you know that the crap is isolatedand easily replaceable. Focusing on a sane decoupled architecture first. The rest can be cleaned up later if on a tight schedule.

16.

17.

18.

19.

20.

21.

22.

23.

24.

25.

26.

27.

28.

29.

30.

31.

32.

33.

34.

35.

36.

37.

38.

39.

7/23/2019 39 Best Kept Secrets of Great Programmers _ Quora

http://slidepdf.com/reader/full/39-best-kept-secrets-of-great-programmersquora 3/3

Advertise Log In Make HuffPost Your Home Page RSS Careers FAQ

User Agreement Privacy Comment Policy About Us About Our Ads Contact Us

Copyright ©2015 TheHuffingtonPost.com, Inc. "The Huffington Post" is a registered trademark of TheHuffingtonPost.com, Inc. All rights reserved.

Part of AOL Tech

Conversations

MORE:

More questions on Quora:

Computer Science: What is a coder's worst nightmare?

Computer Science: What differentiates a "senior" programmer from a "regular" programmer?

Computer Programmers: How does one become a great coder?

Follow Quora on Twitter: www.twitter.com/Quora

Computer Programming Careers Careers Career Advice Computer Science Computer Programmers

Huffington Post Search

0 Comments Sort by

Facebook Comments Plugin

Top

Add a comment...