by Ahmed
1. July 2011 02:09
I was asked by someone recently what I would want to see in a code base that I may've recently inherited. As devs we certainly come across new code bases all the time, some big others small. Here are a few things that I would really like to see:
General code readability & maintainability:
- Use of consistent coding conventions
- Proper code formatting e.g. no extra spacing or unwanted line breaks (Note: it's easy to reformat code using editors these days though).
- Use of a source control system. Although I don't think anyone really develops without a source control these days (or do they?)
Setup and modularity:
- Functionality broken into multiple projects/assemblies
- Layered architecture to separate concerns
- Easy to map namespaces to an assembly. From personal experience, I feel this can cause a lot of confusion sometimes.
- Build script for the solution
- Deployment scripts and/or packages
Design:
- OO basics are applied (assuming an OO programming language is used) i.e. abstraction, encapsulation, inheritance, polymorphism
- Less depth in inheritance hierarchies. While I understand this can be hard to get away with in large applications I am against inheritance abuse.
- Design patterns
- (Any) SOLID principles in use. I would really like to see Single responsibility, Open/closed and Dependency inversion principles.
- No obvious code smell e.g. code duplication, God objects, spaghetti code etc
- Caching, paging and other general performance considerations in code and database queries
- Well known frameworks in use e.g. NHibernate, jQuery, log4net etc
- Error handling (where it makes sense) and logging
Testing
- Automated unit/integration tests
- Mocking frameworks in use
- Automated UI testing (if possible)
I'm sure there are other things that could make into this list.