Mandolin Creek System Helpers (MCSH)

Architecture and Design Guide

This guide provides an overview of the Mandolin Creek System Helper (MCSH) architecture and design, introducing the key concepts, organization, and components. Other documents (linked herein) provide information about the architecture and design of individual subsystems and components.


Table Of Contents


Introduction

Application Frameworks

The MCSH package provides hundreds of interdependent scripts that collectively implement an application frameworks. This frameworks provides the foundation for developing additional scripts, without having to reinvent all of the plumbing required to build a good script.

Integrated Development Environment

The MCSH package provides an integrated development environment (IDE) that facilitates rapid prototyping, forking, and more. These features automate the MCSH script development, testing, release, and deployment processes.

The MCSH IDE can be used to create all new projects, tools, and libraries using simple wizards.


The MCSH Language

The MCSH scripts are implemented in the GNU Bource Again SHell (GNU bash, or bash). This obvious but easily-overlooked implementation detail defined most of our design decisions, which in turn led to the evolution of the current architecture.

And yet, the system has already begun to evolve in a direction that effectively makes its scripts a superset of Bash, adopting strict (i.e. machine parsable) standards for coding and documentation styles.

As such, several terms in this document need to be defined clearly at its very outset, to disambiguate their meanings from any that shell programmers might already take for granted.

Scripts, Libraries, and Tools... Oh, My!

A MCSH script is a single file on disk. Each script implements an application or a reusable library. The terms application script and library script disambiguate these terms from a C, Python, or other kind of library, so the documention refers to them as such when needed.

Libraries

Functionally, the MCSH libraries are organized in a layered fashion. Each library script should be clearly identifiable as fitting into one of the following categories:

  • Abstract
  • Backend
  • Technology
  • Tool

Abstract Libraries

Abstract libraries encapsulate abstract functionality, allowing managing systems or services without knowing about the implementation details.

Trivial abstract libraries may be referred to as interface libraries, since a simple would implementation only serves to provide an abstract interface to the scripts that implement that interface.

Top-level abstract libraries may implement the interface to an extension group, in which case they may be referred to as extension libraries.

Examples: mcui

Backend Libraries

Backend libraries implement alternative technologies for an abstract library.

These scripts usually exist within the namespace of the abstract interface library that they implement.

Examples: mcui/cli mcui/dialog mcui/kdialog

Technology Libraries

Technology libraries integrate individual tools to provide a particular functional technology, utilizing other libraries as needed.

These scripts have their own unique tech namespaces.

Examples: net/tech/apache net/tech/nginx

Tool Libraries

Tool libraries wrap complex external programs. These script wrappers provide several improvements over the bare tools:

  1. Tool library APIs provide literate programming interfaces for what are often oblique and obscure sets of command line options and parameters.
  2. A tool library should improve the funtionality of programs by leveraging other MCSH scripts: timestamps, logging, simulated execution, native dependency handling, and much more.

Examples: net/tool/apache and dev/tool/make.

Important

Tool library scripts should be placed in a <group>/tool module.

Applications

The MCSH package provides several different classes of application scripts: tools, helpers, and programs.

The documentation needs work to be consistent in its usage of these terms, so this terminology may evolve in the future.

Regardless of what they are called, these conceptual distinctions serve to clarify the architecture of the system by grouping additional design and implementation policies.

Tools

Tools scripts assist with flag day transformations in the code base and other ephemeral events. They have intentionally limited scope and lifespan, and they are not included in the package release distribution.

Tools scripts are located in the top-level tools/ directory.

Helpers

Helpers scripts expose functionality in low-level tool or technology libraries. There are a lot of these, and they are quite useful for developers, system administrators, and power-users. However, these scripts tend to be too low-level for most end users.

Programs

Program scripts provide a user-level application experience. They implement complex workflows that leverage multiple script groups and domains.

Modularity

The MCSH script architecture strives for a high degree of modularity. Toward this end, the MCSH project has adopted these architectural policies for modularity:

  • Better: Modularity must improve overall readability, reusability, and efficiency of the source code.
  • Smaller: Scripts must be able to leverage any reasonable subset of libraries, without load any more libraries than needed.
  • Clearer: High levels of introspection must be possible
  • Simpler: Dependencies must be handled simply and clearly

This section describes the modular architecture in MCSH that ensures we move toward these lofty goals.

Script Groups

MCSH scripts are categorized into a handful of script groups. A script group itself is divided into three parts: a library group (in libs/<name>/), an (optional) tool group (in src/<name>/), documentation (in docs/<name>/).

The MCSH package provides the following built-in script groups:

  • core: Core Libraries
  • sys: System
  • net: Network
  • sec: Security
  • doc: Document/Office
  • dev: Development

We have developed and scheduled many exciting additional groups on our roadmap for future major feature releases. Several more groups are scheduled to appear before MCSH reaches v1.0

Script Modules

Inside each script group, script modules provide additional logical collections of scripts. Like script groups, script modules may be comprised of both a library module and a tool module.

For example, the dev group contains several important script modules:

  • The dev/package module produces and publishes all of the package distribution and release files.
  • The dev/docs module generates all of the package documentation, utilizing the dev/package libraries internally.
  • The dev/tool library module contains wrappers for individual development tools.

The dependency graph for the dev script tool group

Script modules may offer their own high-level command interfaces that integrate and expose all of the individual library components. These libraries can be referred to as wizard scripts for all the magic that they perform.

Package Extensions

MCSH includes a powerful package extension mechanism, documented in the MCSH Package Extension Developer's Guide. This mechanism allows developers to extend the package in radical new directions.

For example, the project roadmap includes plans for distributing custom MCSH Python Scripts. The foundation for that will be a python extension that knows how to build and install those components. Similar extensions could be implemented to integrate support for distributing tools written in other languages, such as C, Perl, or any other langue du jour.


Documentation

The MCSH package can be said to be entirely self-documenting:


View the Developer Guide Index

View the Reference Manual Index


Generated on Fri Jul 28 14:34:26 PDT 2017 by mcsh d14 v0.23.0.