Software Engineering Best Practices

Following software engineering best practices allows a developer to be efficient while also ensuring quality and replicable work.


1. Clean code

Clean code is simply explained as easy to read and understand which does a couple things. 

It allows for reduced time for current and future debugging, editing, and collaboration. 

Collaboration is an important aspect, my first real introduction to team collaboration was in my last year of university 
where a team of 9 of us worked on a project for a client. This allowed for us to practice applying real world 
principles such as design, implementation, testing, and thorough IEEE documentation standards. 
https://github.com/mnothman/HD-Requester


Critical aspects that should be focused on include:

Consistency: Using consistent naming and coding styles. Name styles include- CamelCase, PascalCase, snake_case, 
while coding styles/conventions include PEP 8 for Python.
Avoiding Hardcoding: Hardcoded values should be replaced with constants or configurations to make code more adaptable
and modifiable. 
This is exceptionally true for cases such as api keys or other sensitive information, which should be stored in environment
variables such as dotenv or secret files. An example of specific best practices for languages such as JavaScript include- avoiding
global variables, declaring local variables using “var, let, const”, and declaring variables on the top of each function to reduce
unwanted declarations and providing a singular place to look for local variables. 
Commenting: This is an aspect that I have had to learn the hard way over the years. Commenting should be focused on why code
is done a certain way, and not what the code is doing. 
Refactoring: revisiting and refining code to simplify and update as the code base grows, this allows for enhancing clarity and
removing redundant and obsolete code. This allows for readable functions to make them modular and clear. I have had plenty of
cases where I look back at certain parts of a project months later and become confused on why I did certain things in the past,
so it may be an option to refactor as code if time permits and future functionality changes, and can also serve as a refresher.




2. Version Control

Learning version control systems such as Git has been vital to my own software development journey. I remember very early on
years ago being scared of merge conflicts and git commands, even going to the extent of making new projects and copy-pasting
my code so I did not have to deal with merge conflicts and git commands. Some fundamentals about version control include:

Proper Branch Strategies: Creating branches for features and functionality and using pull requests for code reviews instead
of pushing and committing straight to the main branch. Previous legacy branching models include previously popular
workflows such as GitFlow or Github Flow have been replaced with full on modern DevOps practices.

Committing: Committing small and frequent changes with meaningful messages in order to properly track changes, while
also ensuring to test frequently. They should be concise and descriptive, e.g.: "Added login authentication using OAuth2"
instead of "authentication added"

Testing: Most of my testing personally is done with Selenium, however using testing frameworks such as Jest, JUnit, and
others allows for automating testing and repetitive tasks to ensure efficiency. Commits should be small and frequent
between main and feature branches to ensure changes are understood and do not introduce bugs.



3. Automated Testing

Automated testing is vital for software engineering, to ensure that code is reliable and maintainable. Editing and modifying
code that is broken or has bugs can lead to a chain of future issues that can build on top of each other. Automated testing
is very important for multiple reasons:

Efficiency and Reliability: Automated testing when paired with Continuous Integration/Continuous Delivery (CI/CD)
assists in efficiency and proper organization of deployments and time being saved while also maintaining reliability. 

Better Modern Design: Multiple modern design patterns for software development integrate automated testing. These
practices include Test Driven Development (TDD) and Behavior Driven Development (BDD) which are revolved around
automated testing, to ensure that both functional and non-functional requirements are met (security, maintainability,
thorough use cases).

- Unit testing should be done to test individual functions/modules of new code created to keep isolation for simplicity,
while also ensuring all features and edge cases are met.
- Integration testing for ensuring different services work and interact together.
- End to  testing can be done for simulating real world usage of software.
- Performance testing is done to measure performance of a system under load to identify and fix bottlenecks.

Comments

Popular posts from this blog

Netflix and On Demand Streaming