SOP's
SOP's
A well-defined deployment process minimizes errors and downtime. Use this as your
standard operating procedure for manual deployments on your local Tomcat server.
A. Pre-Deployment Checklist
1. Committed, Merged
2. Passed all Unit/Integration tests.
o Code Reviews: Confirm that code reviews have been completed and
approved.
o Backup: Copy the current WAR file and export any critical data.
o Server Health: Verify that the local server has sufficient disk space and is not
experiencing performance issues.
o Release Notes: Document changes for team visibility and rollback planning.
B. Deployment Steps
Copy
cd [TOMCAT_HOME]/bin
./shutdown.sh
o Copy the new WAR file (built from the latest code) into the webapps
directory.
o Ensure that the WAR file is correctly named (e.g., myapp.war) for automatic
deployment.
bash
Copy
cd [TOMCAT_HOME]/bin
./startup.sh
7. Post-Deployment Verification
o EDP
o Developer
1. Confirm with client whether deployed changes are reflected and
application is working as intended.
C. Rollback Procedure
Immediate Action:
o Replace the new WAR file with the previously backed-up WAR.
o Document the incident and any lessons learned for process improvements.
Efficient and secure database management is key. Below are detailed practices for schema
design, modifications, query optimization, and performance checks.
Naming Conventions:
o Use consistent and meaningful names (e.g., table names should be singular or
plural consistently; column names can follow snake_case or camelCase).
o Define clear data types and constraints (e.g., NOT NULL, UNIQUE, DEFAULT
values).
o Example:
sql
Copy
department_id INT,
);
Adding Columns:
o When adding columns, consider the impact on existing data and application
logic.
o Use migration tools like Liquibase or Flyway to track and apply schema
changes.
o Example:
sql
Copy
Entity Mapping:
o If using an ORM like Hibernate, keep your entity classes in sync with your
database schema.
java
Copy
@Entity
@Table(name = "employee")
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "email")
Using Joins
Types of Joins:
o LEFT (or RIGHT) JOIN: Use when including non-matching records is necessary.
Best Practices:
o Example:
sql
Copy
FROM employee e
Indexing
When to Index:
Types of Indexes:
Maintenance:
Example:
sql
Copy
Analyzing Queries:
o Use the EXPLAIN command to analyze and optimize query execution plans.
Consistent coding standards improve readability, maintainability, and reduce errors. The
guidelines below cover general practices as well as detailed aspects of loops, conditionals,
logic, and overall design.
Naming Conventions:
o Indentation: Use 4 spaces per indent level (consistent use of spaces over
tabs).
Error Handling:
Efficient Iteration:
o Enhanced For-Loop: Use the for-each loop when iterating over collections or
arrays.
java
Copy
// Process item
o Modification Safety:
Do not modify a collection while iterating over it unless using an iterator that
supports safe removal.
o Stream API:
Consider using Java 8’s Stream API for clarity and functional-style operations:
java
Copy
itemList.stream()
.forEach(System.out::println);
Conditionals
o Guard Clauses:
Check for error conditions or invalid states at the beginning of methods to
reduce nesting:
java
Copy
if (object == null) {
o Ternary Operators:
Use for simple, single-line assignments only:
java
Copy
Single Responsibility:
Each method should perform one clear task. If a method grows too complex, refactor
into smaller methods.
Readability:
Use self-explanatory names and extract repeated logic into helper or utility methods.
Error Handling:
Validate inputs early, and use custom exceptions where appropriate instead of
generic ones.
SOLID Principles:
o Open/Closed: Design classes that are open for extension but closed for
modification.
Design Patterns:
Dependency Injection:
o Leverage Spring’s DI by preferring constructor injection over field injection to
improve testability and reduce coupling.
Layered Architecture:
o Controllers:
Handle HTTP requests and delegate business logic.
o Services:
Encapsulate business logic.
o Repositories/DAOs:
Manage database interactions.
o Validate request inputs using @Valid and related annotations, and handle
exceptions centrally with @ControllerAdvice.
o Write unit tests for critical logic using frameworks like JUnit and Mockito.
o Use code reviews (via pull requests or similar workflows) to ensure quality.
o Integrate static analysis tools (e.g., SonarQube, Checkstyle, PMD) into your
build process.
Version Control:
o Write clear commit messages that explain the "what" and "why" of changes.
Final Recommendations
Documentation & Training:
Keep these guidelines in a central, easily accessible document. Provide training
sessions or workshops to help new team members understand and adopt these
standards.
Continuous Improvement:
Regularly review and update these standards as technologies evolve and the team
identifies areas for improvement.
Tooling Integration:
Use automated tools for static analysis, testing, and deployment to enforce these
guidelines consistently.
By following these comprehensive procedures and standards, your team will be better
equipped to deliver high-quality, maintainable, and efficient software while minimizing
deployment risks and ensuring robust database management. Happy coding and deploying!