What-are-some-of-the-most-basic-things-every-programmer-should-know

  1. Calling a function from within a loop is no more efficient than running all the function’s code within said loop.
  2. Executing a loop of N iterations inside a loop of M iterations will consume at least M times as much time as executing the loop of N iterations once.
  3. Numeric values are not inherently binary, hexadecimal or base-10. A numeric value is the same no matter the base in which you choose to express it. Therefore it doesn’t make sense to ask how to convert an integer value to binary, only how to express it as binary.
  4. One byte is 8 bits and can represent 256 values. The number of values any variable can represent is determined by 2^n where n is there number of bits reserved for the variable
  5. Retrieving and removing a value from a stack is called popping and returns the most recent value added, while retrieving and removing a value from a queue is called dequeuing and returns the oldest value.
  6. A 1-dimensional array of X bytes consumes at least X bytes of memory. A 2-D array of X-by-Y bytes consumes at least X*Y bytes of memory.
  7. A 2-dimensional array is basically the same as a 1-dimensional array whose values are accessed by calculating the index with Ywidth+X. *Edit:** My point here is not that all 2 dimensional arrays are really just 1-D arrays. My point is that a simple 2-D array of 2 fixed dimensions can generally be implemented with a 1-D array.
  8. Printable text in a program is generally referred as a string. Every character in a string generally takes at least 1 byte.
  9. Unicode is a standard that allows most known characters in all languages around the world to be represented by a single coding scheme. (There’s much more to know here, but not all of it is basic and understood by all programmers.)
  10. UTF-8 is a Unicode encoding scheme that allows the most common Latin-based characters to be represented in 1 byte, while other characters can take 2 or more bytes.
  11. If it’s not tested, it doesn’t work.
  12. Source control is your friend - make sure you use it.
  13. Just because you wrote it doesn’t mean you own it — don’t be offended if someone else on your team has to change your code.
  14. Don’t reinvent the wheel, library code is there to help.
  15. The fastest code is code that’s never executed — look for early outs.
  16. Just because you didn’t write it doesn’t mean it’s crap.
  17. Source code is just a hint to the compiler about what you want to do, it won’t necessarily do it (e.g. You might declare a function as inline but the compiler doesn’t have to obey).
  18. Code that’s hard to understand is hard to maintain.
  19. Code that’s hard to maintain is next to useless.
  20. “Whilst I’m editing this file I’ll just…” is a great way to introduce feature creep and bugs.
  21. The neater your code layout, the easier it is to read. The easier it is to read, the easier it is to understand and maintain.
  22. Code is not self documenting. Help others by adding comments to guide them. You may understand it now but what about in 5 years time?
  23. Bad Code can and will come back to haunt you.
  24. There is no such thing as a 5 minute job. It’ll always take at least half a day.
  25. Magic numbers are bad.
  26. Constants don’t take up storage, they’re compile time text substitutions.
  27. Project management will always want you to do twice as much in half the time.
  28. If there is a bug, the user will find it.
  29. A code review is not a criticism.
  30. It’s not the quantity of code that matters, it’s the quality. Any idiot can bang out 40kloc but that doesn’t make it fit for purpose.
  31. The true cost of poorly written code is in the maintenance.
  32. Eat your own dog food — fixing bugs in your own code helps you code better and improves your understanding.
  33. Code rots over time.
  34. If the user didn’t ask for a feature, don’t add it.
  35. If it’s not tested, it doesn’t work (yes, I know I’ve included that twice but it’s really important).
  36. Networking basics - ssh tunnels, subnets, basic routing tables, TCP protocol, HTTP basics.
  37. Memory - probably should know a little about how memory is laid out, virtual addresses, paging, page frame; user space and kernel not details - but just an accurate higher level idea.
  38. Basic Data types and their sizes (uint, float, string, character/rune etc.
  39. If you are in JVM or any runtime oriented landscape probably should know how GC overall works; generational collection in JVM is interesting to follow. Mark and sweep.
  40. Basic and extremely practical knowledge of data structures and algorithms - you need to be able to apply things you’ve learned - I know many people who know all theory in the world but to them it seems no problem can be applicable to any catalogue full of algorithms and data structures they know off. Linked lists, stacks, queues, trees and graphs and some of the basic algorithms of sort, search etc.
  41. Working knowledge of computer hardware - if leave this to readers; I prefer to understand a lot of details.
  42. You probably should be proficient in one of those editors like Vim, Emacs, Sublime, IntelliJ, Eclipse (any but one) …
  43. Should be able to step through code. (Think gnu tool chain, gdb, IntelliJ debuggers for Java world for example).
  44. Understand relational calculus a bit - write sql queries . Know what is and how to use a relational DB - and a NoSql Db.
  45. Know what files are and how file system works in general from kernel and user space view points - understand why IO is a bottleneck - good if you know scatter gather, mmap and other voodoo ;-)
  46. Functional programming - know functions as data, first order functions, higher order functions, map, flatMap/bind, fold. You do not need to be a Haskeler or a Lisper for this. Fairly common to have such constructs in most modern languages today.
  47. Understand what pointers are (if you are in JVM world ignore this but it would still be worthwhile to know); and how things are allocated and accessed.
  48. Know about threads - Green threads, Coroutines; how concurrency maybe managed and how does it translate to core utilization.
  49. Knowledge of HTML5 canvas and other simple constructs.
  50. CSS Box model and general CSS
  51. Knowledge of ES 6 fundamentals.
  52. Knowledge of Node package manager and a JS build system
  53. There will always be someone somewhere, you’d write a better code
  54. Always test your code, for both, usual cases and edge cases
  55. Never trust the user input, always sanitize it
  56. Always check for buffer overflows
  57. Leave the code better than you got it
  58. You will spend more time thinking about the code, than actually coding
  59. A bad design will haunt you as soon as the requirement changes even slightly
  60. Under-commit and over-deliver, always
  61. Your success will depend more on your soft-skills and how you articulate the problems and solutions to them, than your technical ability
  62. When asked for an estimate on a feature, always overestimate for a 20% buffer
  63. Do not get emotionally attached with the code. The fact that you wrote it does not mean that someone else cannot change it
  64. You’ll see a few of your prototype implementations (POCs) making it to the product, and a lot of them being scrapped, don’t take it to heart, that’s the way things work
  65. Use source control, and do frequent commits (squash commits before pushing to remote), it will save you in case of a disaster
  66. Bad code will come back to haunt you in future
  67. Take code reviews positively. Do not get into a code review with an ego, take review positively and learn to improve
  68. Learn to read between the lines from the business requirements and try to convert them into technical requirements
  69. It is a good idea to discuss your solution with another programmer before starting to implement it, you might learn more
  70. Always document the code well, it will help others (including yourself) in the future
  71. Improve your skills over time, otherwise you will become obsolete in the industry
  72. Your QA folks should be your friends, that will save you a lot of trouble
  73. Try going into meetings with solutions to problems, rather than just problems, your folks will start liking you
  74. Never, ever, push a feature in production unless it is well-tested
  75. Love your job, but not your company, you never know when your company might stop loving you

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2020-2022 Henry
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信