While there are many challenges today with building web applications, there are also many options to address the issues we face with technology, process, and people, allowing us to reap the benefits of the web as an application platform.
While many of the challenges with today’s web applications come from the vast array of technologies that are available, there are clear strategies that can be employed to turn those same issues into advantages that can make building applications easier. The key is to use a technology portfolio that allows applications to be modular, simple, and isolated from any instability in the underlying platform. Another critical aspect of each member of this portfolio is that it must be able to maintain those abilities at the scale at which the application will be built.
In order to reduce complexity, we need to understand that just because something is possible does not mean it is necessarily the right choice or the only choice. Many technologies allow high levels of abstraction to be introduced in order to keep code as isolated as possible, but sometimes we need to take a step back and think about how to make things simpler and easier to manage and maintain, rather than adding multiple layers of complexity to solve a fairly easy problem. By choosing technologies that allow abstractions to be introduced, but combining that with a disciplined approach to using those abstractions, complex problems can be solved with clean, maintainable code.
One of the most crucial decisions developers can make when dealing with instability and change is architectural insulation, a strategy for defining an approach that insulates your code from the portions of the platform that are in flux or changing.
In the early days, web developers focused on the very big challenge of working around very fragile, broken, or incomplete pieces of core browser functionality. Today, it can mean wrapping modern technology that is either changing or where best practices or performance may not be optimal with an API that works well and is flexible.
Tool selection: Beyond the proof of concept
When evaluating a technology, it is imperative that the investigation move beyond a basic proof of concept and give the technology under consideration a thorough analysis.
This requires having the patience to fully understand the right way of using a technology, giving it a solid evaluation. This also requires not being biased based on something being seemingly simple out of the box, or mistaking a nice looking website for something that will be a powerful tool for creating impressive web applications.
Organization and process solutions
While technology is a primary source of the challenges and solutions related to modern software development, the processes that govern the use of those technologies can also serve to hinder or help development projects. Some of the primary processes that can benefit a project are code transpilation, effective source code management strategies, code quality metrics and automated processes for testing and continuously integrating changes to the application.
One of the best ways to future proof your code today is through transpilation, a form of compilation that takes one version of a language and converts it into another.
In the past, developers would have to wait years to leverage significant improvements to the platform. Now, developers can author code following modern best practices, and then convert it to code that runs on all platforms today.
Source code management and strategy
Previously, most traditional source control systems made it rather difficult to efficiently maintain branches of code and easily review changes. While it is easy to believe that all of these systems are the same, modern tools, such as Git support processes that reduce the risk in breaking the master code line.
With the ability to efficiently merge and branch, it is easier to review changes before they are merged with the main code line.
The most popular tool to solve these problems today is Git, which has brought many benefits of distributed source control to the mainstream, but it is not the only solution.
Organizations should create, maintain, and follow internal code standards and have a regular review process to make sure that source code meets a certain standard and works as expected. And this should happen before it lands in the source control master.
There are many tools and approaches to facilitate review, but it requires a team of people that demand excellence, accept criticism, and understand that the goal is to create the highest quality, most consistent source code to deliver a robust and maintainable web application.
In a world with many different browsers and platforms, automated testing is more important than ever. This usually begins with an approach to writing code that is testable at all times (TDD, BDD, or some similar methodology). By integrating the creation of tests into the development process, the quality of the code base can be measured more clearly and the maintainability will also increase, due to the ability to quickly assess if a change causes failures in existing features. Automated tests are normally grouped into two types: unit tests and functional tests.
Developers should typically begin with unit testing, which allows a team to test each portion of a codebase, in isolation, with minimal dependencies. Complex interactions may then be mocked or stubbed with a simple interface.
Functional testing is then leveraged to test the approach of an end user. Functional tests are inherently much more difficult to author, so the more that a development team can test with unit tests, the easier an application is to test and maintain.
Continuous integration and code coverage
There are many platforms and services to automate testing. Continuous integration (CI) notifies a team if any automated tests failed with each additional commit made to the application source tree, or with any potential commit that is being considered for acceptance into the codebase.
Code coverage analysis tells a team that, not only did their tests pass, but verifies that they were careful enough to thoroughly test all of their source code. CI also includes information about code coverage, and other relevant details. There are many CI tools on the market, and flexible testing tools can be used within any of these environments.
Testing tools and continuous integration may also be used to test other metrics, including performance regressions, user interface changes, and accessibility.
An optimized CI environment helps organizations track changes in test compliance, code coverage, performance, and other metrics with each change to their source code.
There are many ways to measure code quality, but consistency is the first step towards creating a codebase that is easy to follow and maintain. Beyond consistency, enforcing certain patterns and excluding anti-patterns is essential to preserving good software architecture. These same linting tools may be configured and customized to verify these patterns are followed.
Various code linting tools such as ESLint, TSLint, and JSHint exist to help teams verify that their code is structured to their own internal standards.
While tools can catch many things, peer reviews of source code will also help in areas that are not easy to capture with tooling.
Compared to just a few years ago, far better development tools are provided by web browsers and within Node.js for debugging and introspecting applications.
Engaging and managing your team
Robust architecture and a solid development process helps solve many challenges. This provides a solid foundation for then working with your team to make sure they’re able to deliver solid solutions.
It is important to encourage teams to think enough up front to reduce the likelihood that they will need to constantly rewrite. Remember that agile does not mean that you no longer need to think or explain what you’re trying to achieve, just that it means that there is ongoing flexibility to adjust and iterate on ideas over time.
Another challenge an enterprise may have to manage is that engineers often think in terms of agile, but other elements of the business do not when it comes to contracts and deadlines.
The solution to this challenge is not always easy, and varies widely per organization. Fundamentally it requires organizations to find a balance between agility and predictability that is right for them.
Reducing choices and complexity
With so many powerful technologies being continuously released, it is tempting to forget that adopting too many technologies can work against the creation of a robust and scalable application. By reducing some of the options, the complexity of your application architecture can be greatly reduced. It may be helpful to think about how well the person that needs to maintain your application in two years will do with what you have created, even if that person may be you.
It is important to not only document your source code, but also major decisions that have been made and why. This reduces the likelihood of having the same debates over and over again, especially with each new hire.
Giving people a reason to stay
Software developers today have many opportunities to grow their careers. This can lead to high turnover rates in some organizations. This leads to difficulty in preserving quality and architecture over time as no one can remember why things are done the way they are (unless they are well documented!).
Therefore, it’s important to give people a reason to stay. This can be done by creating a positive environment to create good software, compensating people fairly, removing obstacles that get in the way of being productive, reducing artificial pressure such as arbitrary deadlines, and encouraging people to do their best work.
InnerSource and open source
Organizations often find themselves in silos where teams do not share code across groups, and reinvent features and applications without consistency across the enterprise.
An emerging trend called InnerSource brings many of the lessons learned with large open source projects to internal enterprise efforts. In many cases these are social and quality issues, the same challenges that successful open source projects solve, to encourage reuse and collaboration among teams, while solving problems that would normally prevent this from occurring.
Organizations may also benefit from open sourcing some of their work. Each organization is different, but either opening up some software, or contributing fixes and improvements to key open source dependencies, helps keep the ecosystem that most organizations depend on improving all the time. Many organizations find that contributing to open source improves team morale, helps recruit talented engineers, and finds and solves issues more expediently.
We have covered many possible solutions to challenges with technology, process, and people when building web applications.
In the final installment of this series, we will expand on some of SitePen’s approaches and choices to how we actually solve these problems today.