Skip to main content
Engineering LibreTexts

8.7: Baselines

  • Page ID
    45258
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    A baseline represents the skeleton or architecture of a project in terms of the structural dependencies between packages or projects. A baseline defines the structure of a project using just package names. When the structure changes, the baseline should be updated. In the absence of structural changes, the changes are limited to picking specific versions of the packages in the baseline.

    Now, let’s continue with our example. First we modify it to use baselines: we create one method for our baseline. Note that the method name and the version pragma can take any form. Still, for readability purposes, we add ’baseline’ to both of them. It is the argument of the blessing: message that is mandatory and defines a baseline.

    ConfigurationOfCoolBrowser>>baseline04: spec    "convention"
        <version: '0.4-baseline'>                   "convention"
    
        spec for: #common do: [
            spec blessing: #baseline.                "mandatory to declare a baseline"
            spec repository: 'http://www.example.com/CoolBrowser'.
            spec
                package: 'CoolBrowser-Core';
                package: 'CoolBrowser-Tests' with: [ spec requires: 'CoolBrowser-Core'];
                package: 'CoolBrowser-Addons' with: [ spec requires: 'CoolBrowser-Core']]
    

    The method baseline04: defines the structure of 0.4-baseline, which may be used by several versions. For example, the version 0.4 defined below uses it, as shown in Figure \(\PageIndex{1}\). The baseline specifies a repository, the packages, and the dependencies between those packages, but it does not specify the specific versions of the packages.

    Importing a baseline that expresses dependencies.
    Figure \(\PageIndex{1}\): Version 0.4 now imports a baseline that expresses the dependencies between packages.

    To define a version in terms of a baseline, we use the pragma <version:imports:>, as follows:

    ConfigurationOfCoolBrowser>>version04: spec
        <version: ’0.4’ imports: #('0.4-baseline')>
    
        spec for: #common do: [
            spec
                package: 'CoolBrowser-Core' with: 'CoolBrowser-Core-BobJones.15';
                package: 'CoolBrowser-Tests' with: 'CoolBrowser-Tests-JohnLewis.8';
                package: 'CoolBrowser-Addons' with: 'CoolBrowser-Addons-JohnLewis.3'
        ].
    

    In the method version04:, we specify the specific versions of the packages. The pragma version:imports: specifies the list of versions that this version (version ’0.4’) is based upon. Once a specific version is specified, it is loaded in the same way as before, regardless of the fact that it uses a baseline.

    (ConfigurationOfCoolBrowser project version: '0.4') load.
    

    Loading Baselines

    Even though version 0.4-baseline does not contain explicit package version information, you can still load it!

    (ConfigurationOfCoolBrowser project version: '0.4-baseline') load.
    

    When the loader encounters a package without version information, it attempts to load the most recent version of the package from the repository.

    Sometimes, especially when several developers are working on a project, it may be useful to load a baseline version to access the most recent work of all of the developers. In such a case, the baseline version is really the “bleeding edge” version.

    Declaring a new version. Now suppose that we want to create a new version of our project, version 0.5, that has the same structure as version 0.4, but contains different versions of the packages. We can capture this content by importing the same baseline; this relationship is depicted in Figure \(\PageIndex{2}\).

    ConfigurationOfCoolBrowser>>version05: spec
        <version: ’0.5’ imports: #(’0.4-baseline’)>
    
        spec for: #common do: [
            spec
                package: 'CoolBrowser-Core' with: 'CoolBrowser-Core-BobJones.20';
                package: 'CoolBrowser-Tests' with: 'CoolBrowser-Tests-JohnLewis.8';
                package: 'CoolBrowser-Addons' with: 'CoolBrowser-Addons-JohnLewis.6']. 
    

    Creating a baseline for a big project will often require some time and effort, since it must capture all the dependencies of all the packages, as well as some other things that we will look at later. However, once the baseline is defined, creating new versions of the project is greatly simplified and takes very little time.

    A second version importing the same baseline.
    Figure \(\PageIndex{2}\): A second version (0.5) imports the same baseline as version 0.4.

    This page titled 8.7: Baselines is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Alexandre Bergel, Damien Cassou, Stéphane Ducasse, Jannik Laval (Square Bracket Associates) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.