5 Common mistakes while building an application from scratch

Sakshi Khandelwal
Nerd For Tech
Published in
3 min readJun 6, 2022

--

Sometimes common is not very common. We knew or read or learned some things a while back but with time, we tend to forget the basic concepts. I have seen many developers make these mistakes.

So, let’s refresh our simple and common concepts.

1. NEVER HARDCODE

The simplest application needs to connect with the database. For this, while developing the application from scratch, some developers tend to directly give the database URL, username and password in the code.

Or for some business logic, developers provide any environment-specific value, any business values like below in the code:

Is this right? Obviously, not! We just can’t give such things in the code.

For this, we could provide such values in any of the below ways:

  • Use Secrets in AWS, GCP or in RedHat Openshift
  • Use environment variables
  • Use configurable files

Reference: https://medium.com/vaibhav-malpanis-blog/keep-your-secrets-to-yourself-aws-secret-manager-f33d627bb25f

2. Add descriptive comments and not just comments

Developers tend to forget to add comments to the code or add them for the namesake. We think why is this so needed? Being a developer, we think the code is easy to understand. But, we can’t think for ourselves only, think for other developers who are going to code in the same class. We should make readable code that is self-explanatory. We should add comments at the class level and method level like below:

3. Don’t forget loggers

Is the above code right? If yes, then think about it again. We have not added a single log at any level. For the development and testing phases, it seems trivial, but in the production, it could be a life saver! Many times, production errors are not easily reproducible in lower environments and in such cases, loggers are the only help.

4. Make future extensible code

Again, never write code for your task only. Think of future add ons. For example, if you are writing the code for two banking transactions, think to add another transaction in future. For this, we may define the transaction list in the configurable file outside the main code and then when needed, one can add the other transaction in the list in the configurable file.

5. NEVER EVER COMMIT ANY PASSWORD

This is the thumb rule in any application of any industry. The application could be using any programming language but one thing is sure no one should commit any password in the code repository.

Password should be taken as a separate entity. It should not be shared with all the stakeholders of the project. For this, again, we could use the secret of different platforms like AWS or GCP.

Like we have seen the 5 common mistakes in the application, you could also check 5 common mistakes in java at: https://sakshikhandelwal276.medium.com/5-common-mistakes-in-java-68542325a140

Hope you like it.

If you have any related queries, please free to contact me. I’ll be happy to help you if I could. Stay Connected :)

If you liked this post, please clap for it. I would really appreciate it.

LinkedIn: www.linkedin.com/in/sakshikhandelwal276 Twitter:www.twitter.com/SakshiKhandlwl

--

--

Sakshi Khandelwal
Nerd For Tech

Java 8 Certified | AWS Certified Developer-Associate| SSE at MasterCard | Learner