Include

Changes expected

2025-06-23: Changes are expected to the format of include:

  • include will move the plan group to be the first argument.
  • The search path will be included in square brackets to more clearly identify it as a composite argument.

It may be that many plans will use the same set of requirements. For example, in Computer Science, the BCS Coop, BCS Regular, and BCS Joint all use the same depth and breadth requirement. Coding that requirement takes 100+ lines! We don’t want to have to type that in multiple times and, worse, keep all three versions up to date.

We’d like to apply the “DRY” principle – Don’t Repeat Yourself.1 To keep plan specifications DRY, use include. The simplest form is

include(breadthDepth, uw.u.math.bac.cs)

As described in Names & Locations, this will look for a file or database record in /uw/u/math/bac/cs/breadthDepth-TERMID.plan, where TERMID is replaced by the requirement term for this student. If that file does not exist, it will use the file with the most recent requirement term that is before the term given. If no such file exists, it will include a manualCheck.

Using this mechanism, the plan definition for the BCS Coop degree using 1229 requirements might be something like:

plan CSBHC 1229 using all passedCourses {
    include(mathCourseDefs, uw.u.math)
    minAverage(MAV, CSBHC, 60)
    include(coreCS, uw.u.math.bac.cs) 
    include(coreMath, uw.u.math.bac.cs)
    include(additionalCS, uw.u.math.bac.cs)
    include(breadthDepth, uw.u.math.bac.cs)

coreCS, coreMath represent requirements that are common to both BCS Coop and BCS Regular, so splitting them out avoids duplicating requirements in plan files.

Breadth and depth requirements change reasonably frequently but the first three have been stable across many years. Splitting them up like this means that the first three do NOT need to change just because the breadth and depth has changed.

Include search path

The description above is by far the most common use of include. However, there is also a further “search” mechanism that can be useful. This use of include is inspired (required) by a rule at the Math Faculty level that depends on the specific plan the student is enrolled in. Every Math student has a communications requirement but students in the CFM program, STATS/ACTSC, and the double degree Business Administration programs have versions that differ from the default.

This is handled by giving include a “search path”:

include(commReq,
            uw.u.id.bac.cfm,
            uw.u.math.bac.statactsc,
            uw.u.math.bac.cs.dd,
            uw.u.math.bac.mathbus.mathdd,
            uw.u.math.bac
)

The degree audit program will make a list of candidate files and then include the first one from the list that actually exists. If none of them exists, specify that a manual check must be done.

How does the degree audit know which of those locations it should look in for a specific plan? It looks in the same directory that the main plan file is in, and then in all the directories it traversed through to get to that main path.

For example, suppose we’re doing an audit of a student with plan code MATHFINHC (Mathematical Finance) with a requirement term of 1209. The plan group for this plan code is uw.u.math.bac.statactsc.mathfin. The program:

  1. Filters the search path to include only those items that are a prefix of the plan group. Add the last item on the search path even if it isn’t a prefix. This results in
    uw.u.math.bac.statactsc
    uw.u.math.bac
  2. Adds the file name plus requirement terms going back in time, starting with the student’s requirement term:
    uw.u.math.bac.statactsc.commReq-1209.plan
    uw.u.math.bac.statactsc.commReq-1205.plan
    uw.u.math.bac.statactsc.commReq-1201.plan
    uw.u.math.bac.statactsc.commReq-1199.plan
    ...
    uw.u.math.bac.commReq-1209.plan
    uw.u.math.bac.commReq-1205.plan
    uw.u.math.bac.commReq-1201.plan
    uw.u.math.bac.commReq-1199.plan
    ...
  3. Goes through this list and selects the first file that exists.

Explicit requirement term and plan group

It is possible to explicitly override the requirement term and plan group:

include(CSBHC, 1239, uw.u.math.bac.cs.cs, uw.u.math.bac)

This is used internally, but at the present time there are no known uses in user-written plan specifications.

Sub-includes

It is also possible to specify an include that should be included within an include. Again, this is used internally but there are no known applications in user-written plan specifications. See Top Level for more information.


  1. The opposite of DRY is WET – “We Enjoy Typing” or “Write Everything Twice” or “Waste Everyone’s Time”. ↩︎