T B H P N

Project #3 - Type-Based Package Dependency Analysis

Version 1.5
Due Date: Wednesday, October 31th, 2018
Project #3 helper files

Purpose:

One focus area for this course is understanding how to structure and implement big software systems. By big we mean systems that may consist of hundreds or even thousands of packages1 and perhaps several million lines of code. We won't be building anything quite that large, but our projects may be considerably bigger than anything you've worked on before.

In order to successfully implement big systems we need to partition code into relatively small parts and thoroughly test each of the parts before inserting them into the software baseline2. As new parts are added to the baseline and as we make changes to fix latent errors or performance problems we will re-run test sequences for those parts and, perhaps, for the entire baseline. Managing that process efficiently requires effective tools for code analysis as well as testing. How we do that code analysis is illustrated by the projects for this year.

The projects this Fall focus on building software tools for code analysis. We will emphasize C# code but want our tools to be easily extendable to other similar languages like C++ and Java.

Code analysis consists of extracting lexical content from source code files, analyzing the code's syntax from its lexical content, and building a Type Table holding the dependency results. Alternately you can provide an Abstract Syntax Tree (AST) that holds the results of our analysis. It is then fairly easy to build several backends that can do further analyses on the AST to construct code metrics, search for particular constructs, evaluate package dependencies, or some other interesting features of the code.

You will find it useful to look at the Parsing blog for a brief introduction to parsing and code analysis.

In this third project we will build and test a package dependency analyzer in C# that consists of, at least, these packages:

Use of the C# Parser, provided in the C# Repository is recommended. You will find the Project2-InstrSolF2018 to be helpful. That code integrates a complete solution of Project #2 with the C# Parser, and provides some of the rules you will need for Project #3 (not all the Rules and Actions, of course).

Requirements:

Your Dependency Analysis Solution:
  1. Shall use Visual Studio 2017 and its C# Windows Console Projects, as provided in the ECS computer labs.
  2. Shall use the .Net System.IO and System.Text for all I/O.
  3. (2) Shall provide C# packages as described in the Purpose section.
  4. (4) These packages shall evaluate all the dependencies between files in a specified file set. Please support specifying the collection as all C# files in a sub-directory tree, rooted at a specified path. You may elect to also provide an alternate means to specify the collection as a list of filenames, but you are not required to do so.
  5. (3) Your dependency analysis shall be based on identification of all the user-defined types in the specified set of files. That means you will need to identify all of the Types defined within that code, e.g., interfaces, classes, structs, enums, and delegates. You will also need to consider aliases, since an alias may refer to a type defined in another file. One last obligation - you need to account for namespaces3.
  6. (3) Shall find all strong components, if any, in the file collection, based on the dependency analysis, cited above.
  7. (3) Shall display the results in a well formated area of the output.
  8. (5) Shall include an automated unit test suite that demonstrates the requirements you've implemented and exercises all of the special cases that seem appropriate for these two packages4.

  1. In C#, a package is a single source code file that contains:
    • prologue, providing a name, brief descriptive phrase, author information, and environment information
    • description of the package's responsiblities and required files
    • maintenance history
    • class definitions
    • a main function that implements construction tests for all the defined code
  2. A software baseline is the set of all code considered to be part of the current system, excluding experimental code that individual developers are working on.
  3. A correct C# program may use two or more classes with the same names, provided that they reside in different namespaces.
  4. This is in addition to the construction tests you include as part of every package you submit.

What you need to know:

In order to successfully meet these requirements you will need to know:
  1. Basics of the C# language: C# tutorial - PROGRAMIZ
  2. How to implement a simple class hierarchy. This will be covered briefly in lecture #3 and in more detail later.
  3. The .Net Containers.
  4. How to use Visual Studio. We will discuss this in one of the Help Sessions.
  5. How the parser, cited above, works.