Hi, I'm Martin

I'm a Web Developer

Martin Sundvall

Hi, I'm Martin

I'm a Web Developer

Checklist for a maintainable angular application

5 minutes
March 21, 2023

As a developer in a new context, both in team and in code base, the task was to extend an existing feature. To accomplish this it was not unexpexted to spend some time on resarch and onboarding into the system of, in this case, 2000 files and 185 000 lines of code divided into 485 angular components.
There could be numerous of ways to do this, like in person handover, documentation, well written tests and code following good standards. The balance of these factors, should all guide in the same direction, simplify the onboarding and lover the cognitive threshold as much as possible.
Current functionality was manually tested from end to end perspective and deployed to production long time ago. In general, “it works”, and until changed, it might never break, or will it? The task was to extend an existing feature, and the assumed solution was to duplicate parts of it. Was this a good idea? The existing construction revealed many magic areas, broken scopes, hard coupling, long files and lack of conventions. As a developer in this new context, it seamed very hard to understand and maintain. The onboarding was heavily dependent on great knowledge of the surrounding system and in person handover. Missing tests made refactoring a risky process. When the architecture and conventions and common practices are weak and diverse, there is a high risk of creating a system that eventuallly breaks as it grows. Lack of rules make hacking and fixing the common pattern, and code is never deleted. No one dares to delete anything, and overrides and added ‘if’ conditions are common. The result might be “a big ball of mud” - a system that most developers avoid.

Good habits for a maintainable system

why quality matters

A well written system provides development in isolation, within well defined scopes. Testing is performed with a minimum of mocked data and dependencies. Frontend and backend agrees on some contracts and create their parts with different timing. Testing is done automatically and a balanced amount of well written comments guide any developer to the functionality that matters. Also, quick fixes are possible, since all maintenance from previous hotfixes are completed.

short and long term ambitions to deliver value

When business stress is strong for long periods, it is important to emphasize, that the technical dept can not be ignored. In short time perspective, quick solutions might be delivered, but after a while only error prone features are delivered with poor estimations. It is like maintenance of roads for traffic, or maintenance of boiler rooms (pannrum) or any complex system. In the long term perspective both development team and business share the interest to deliver features on time.

Requirements of a maintainable system

what makes a system secure, performant and easy to maintain?

As a developer I in any area it …

onboarding

As a developer in unknown areas it …

unit tests

As a developer I’d like to confirm, preserve and document the functionality.

integration tests

As a developer I’d like to preserve functionality during refactoring

inline documentation

As a developer I’d like to spend the effort in the relevant area.

folder structure

As a developer I’d like to find relevant functionality in the general system.

clean code

As a developer I’d like to not concern about irrelevant information.

name conventions

As a developer I’d like to reuse my knowledge about the system.

formatting

As a developer I’d like to identify functionality from visual form

conventional patterns

As a developer I’d like to reuse my knowledge from other systems.

together improve

based on the statements in this document the refactoring