This article is more of a general coding guide for people who have just entered the software market or have a keen interest. Although while going through this article you may find it learning more towards Javascirpt(a programming language). But the principles described here are mostly followed in the industry in general. Enough talking its time to take some action. Summary:
Declaring constants in a single file.
Break the code.
Keep entry and exit points as low as possible.
Single responsibility principle
Declaring constants in a single file
Usually in the industry we would keep the stuff that won’t change in the same file where we would be using it(in constants), except for some environment variables used globally. But according to my experience it would be better to declare all the constants in a single file with some great detailed comments, that way any person who would require to access the code base would find it easy to control various aspects of the whole app from a single file. Now by constants i don’t mean only entities containing static values(i.e const variables) but also some common functions having a small single simple responsibility e.g.