Ask HN: How do you write production level code?
1–6 of 6 posts
Re: Ask HN: How do you write production level code?
#2A frustrating fact about coding is that you don't know what you don't know. You feel like an expert, and then someone else shoots you down by introducing you to a new security risk you've never heard of or a technique that's better than the one you've been using.
This risk is a lot lower when you have an experienced team around you. Whatever you might be missing, someone else has a chance of catching it.
It's also much easier to write production-level code when you use a language with robust typing and mature, widely-used, well-tested libraries.
Re: Ask HN: How do you write production level code?
#3Re: Ask HN: How do you write production level code?
#41. Take a task and implement it in the most laziest way (like implementing everything in a single code file)
2. Try to make the implementation "look beautiful" (with proper indentation, etc)
3. Try to make the instructions in your code analyze the return codes, check the input parameters to functions, catch exceptions, split them into various files, functions, classes etc by adding more code.
Third step is where you will try to learn more from the programming language that you have chosen. See https://gist.github.com/nareshv/50fa0884d09622792e34 for example
Once you master the step-3, you will always do begin with these things when you start implementing your project.
Source: Personal experience.
Re: Ask HN: How do you write production level code?
#5Of course what I wrote is a bit of an oversimplification but overall it is how I write real production code that must be reliable.
In general I usually wind up with far more test code then executing production code if I do this all. But like everyone I will get lazy on some of it, which is usually where I find some error later.
Also, this basic design lends itself to either a functional or OO style of coding. Modules need not be classes but classes can certainly help you build modules.
Find people that will give you feedback, even if they aren't in you immediate network or peer group. It is amazing how helpful people can and will be if you just ask, respect their time and be honest about your level of experience and understanding.