Few notes for backend developer which will help to write better production code.
1.Always check any possibility of a null pointer exception.
2.Remove redundant/extra DB or network call. (Query in a loop, N+1 query)
3.In case of database connection, properly use connection pool, pool size, idle size, queue size, monitor pool resource.
4.When querying/searching, think about table size and param index or any performance impact at high load.
5.Measure and profile Database query latency.
6.Handle DB TimeOut(Connection, Read) properly.
7.When network call (REST, in-memory DB, Message Queue), use proper connection pool configuration. (Pool Size, Queue Size, Rejection or exhaustion policy).
8.When third party call, handle Time out(connection & read), try to implement circuit breaker and bulkhead pattern.
9.Always think about the asynchronous process.
10.Be careful about shared resources and critical sections.
11.Try to avoid member variable at spring singleton bean.
Class Name, class size, method name, method size, and variable name should follow clean code rules.
12.Ask yourself, is my method unit testable?
13.Meaningful tag after each release.
14.Every git commit will be an independent feature.
15.Use cache as much as possible.
16.Think about Spring Bean Scope(Singleton, Request & prototype).
17.Try as much automation(Testing, CI & CD)
18.Try to retrieve data from pre-calculated data using the scheduled job.
19.Avoid redundant or any extra variable assignment.
20.Should maintain a proper log with the appropriate level.
21.Follow logging and tracing standard rules.
22.Try as much documentation or note so that QA & System team and another stakeholder do not ask the Developer. Mostly when developers change the config, DB structure, migration script, framework version, library, runtime environment(JDK, python), dependency, new technology.
23.Isolate scheduled jobs from the main application and use standard tools(Jenkins).
24.While writing complex queries, check raw queries and analyze the query using DB tools(like MySQL explain command).
Top comments (0)