Loading TOC...
Reference Application Architecture Guide (PDF)

Reference Application Architecture Guide — Chapter 2

Recommended Best Practices

When designing your MarkLogic application, you should consider incorporate at least the following best practices into your development process:

Organize your project around logical components

You should organize your project in a way that preserves the logical separation of concerns in your application. This makes it easier to share the project among teams working in the different tiers and makes it easier to find source files and other assets.

Use source control for code, tests, and automation drivers

Your source code, tests, automation scripts, and other application assets should all be under source control. Source control preserves historical changes to your application and enables multiple people to work on a project concurrently. Putting all your application development and deployment components under source control also makes it easy to know goes into each release of your product. Even the smallest team benefits from source control.

Make project development and deployment easy to configure

The building, testing, and deployment of your application should be configuration driven.

For example, if you move your testing infrastructure to a new host, you should only need to update a single configuration file, not every test. Similarly, you should be able to change product build dependencies with minimal configuration file changes.

Consolidating such variables into configuration files makes it easier to track and less prone to error when change is required.

Automate development, testing, and deployment tasks

Project development involves many repetitive tasks. For example, a developer goes through the edit-test-debug cycle many times in a single day. Automating common tasks improves productivity and reproducibility.

Similarly, using automation to simplify testing removes barriers to frequent developer testing. Frequent testing improves product stability because problems are easiest to diagnose and fix close to the point at which they're introduced. Test automation also helps improve the reliability of test results.

Automating the setup of your application development and deployment environment makes it easier to add new developers, manage dependencies, and provide a stable development, testing, and release platform.

Incorporate automated testing into all phases of development

It is important to have several levels of tests for your product. For example:

  • Unit tests verify the functionality of specific sections of code, usually at the function/class/interface level. Unit tests are usually created by the developers. Unit tests can easily be run during a developer's edit-test-debug cycle and before each checkin.
  • Integration tests verify the interfaces and integration points between components, such as between the browser tier and the middle tier.
  • Regression tests detect when previously working features break as an unintended consequence of a code change.
  • System tests verify the end-to-end behavior of your application.
  • Smoke tests, sometimes called sanity tests, are a small test set that check for some minimal level of operability. For example, you can use smoke tests to test a project integration branch before merging changes into a code line shared with a larger set of developers.
« Previous chapter