-
Notifications
You must be signed in to change notification settings - Fork 13
Best Practices
The code base shall have the most updated contributions from all the participating members. A stale code base requires too much of offline co-ordination work for the project progress. Hence, a strong endeavor shall be made by all the participating contributors to update the development branch.
Small integration and build times encourage developers to perform the build and integration steps more often. Aggressive caching, dependency installation and parallelization of tests must be used to reduce the integration and build times to less than two minutes.
Testing is an important phase in any project, especially ours whose code base in continuously getting older and larger. Testing is actually an information gathering activity and helps reduce the risks of things going wrong. You could write perfect code but it has so many dependencies which are not necessarily in your control. People might use it differently to how you expected. The platforms it’s used on might be wrongly setup. You might have misunderstood the problem that your code needs to solve etc; the list goes on. Your code could be solving the wrong problem, a changed problem, new information has been thrown in the mix, incorrect assumptions were made.
Specific to IRCLogParser since we will be analysing plethora of logs and we expect a particular trend in all our results, hence the situation demands a way to verify our results.
Other than that unit and end-to-end testing will help keep our code bug free.
Unit Tests
Unit Tests the smallest unit of functionality, typically a method/function (e.g. given a class with a particular state, calling x method on the class should cause y to happen). Unit tests should be focussed on one particular feature (e.g., calling the pop method when the stack is empty should throw an InvalidOperationException).
In short, unit tests are as simple as possible, easy to debug, reliable (due to reduced external factors), fast to execute and help to prove that the smallest building blocks of your program function as intended before they're put together.
End to end testing
End-to-end testing is a technique used to test whether the flow of an application right from start to finish is behaving as expected. The purpose of performing end-to-end testing is to identify system dependencies and to ensure that the data integrity is maintained between various system components and systems.
Related Issues: #28
See the advice of Brian Kernighan on Testing
Modular programming is the process of subdividing a computer program into separate sub-programs. A module is a separate software component. It can often be used in a variety of applications and functions with other components of the system. Similar functions are grouped in the same unit of programming code and separate functions are developed as separate units of code so that the code can be reused by other applications.
Some Benchmarks for modularity:
- How many times are you rewriting similar code for doing a particular task?
- How much code do you have to refactor your code in case you change something somewhere in a part of your program?
- Are the files smaller and easier to navigate through?
- Are the application modules performing adequately and independently as and when required?
- How less disastrous is your code? Does all hell break lose when you delete just one function or variable? Do you get 20-odd errors upon re-naming a class? (For Instance you can implement a stacking mechanism to keep trace of all the hops in your application)
- How near is the code to natural language usage (i.e. modules and their subcomponents represent more real world objects without giving much concern to net source file size).
It is important to have a stable release package and predictable release cycle. Users benefit from simple option for downloading the software and relevant documentation. At any rate, users do not have to experience the broken software / out-of-date documentation that usually happens in a continuous software development environment. The software shall always have a stable release and the corresponding documentation available.
Without documentation, it is hard to maintain any project and the developers have to re-invent the wheel. Keeping in mind future contributors and developers who will be using IRCLogParser, our aim should be document every piece of code that we write.
Specific to IRCLogParser, the documentation resides in docs
directory. Before committing ensure to update the documentation by running the command make html
to update the docs. The continuous integration script must ensure that each commit to the repository requires a successful creation of the documentation. All the project documentation resides in a separate branch named gh-pages
.
Related Issues: #27 Closed : #25
Linters
A linter is a small program that checks code for stylistic or programming errors. I found the following links to be helpful: http://cheng.logdown.com/posts/2015/06/14/sublime3-install-python-linters https://pypi.python.org/pypi/flake8
- Branch History
- Best Practices
- Testing in Python
- Logger Config
- Refactoring Suggestions