T B H P N

Project #1 - Source Code Publisher

Version 1.0
Due Date: Tuesday, February 5th, 2019
Project #1 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, understand them, 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 publishing sources, performing code analyses, and testing. How we do code analysis was illustrated by SMA projects this past Fall year, and, in OOD, last Fall, we implemented a multi-user test facility. This Spring, we will focus on making all the source code for large projects readily available to anyone with a browser - at least anyone working on the project. We will emphasize C++ code but want our publishing tools to be easily extendable to other similar languages like C# and Java. The projects this Spring build software publishing tools in several phases - one phase implemented in each of four projects.
In this first project we will build and test a facility for converting a C++ source code file to a web page3, with essentially the same content. Here's what it does:
Finds and Loads a file for processing:
Files will be loaded when their names match a regular expression. That might be as simple as *.h, but will often be somewhat more complex. You will spend some time getting familiar with the C++11 regex classes. Files that match can be opened with the std::iostream facilities.
Converts file into a webpage fragment:
That entails creating a new file with the same name, but with an html extension. Contents of the source code file are copied directly to the html file. Then all html markup characters are replaced with their exscape sequence equivalents, e.g., < is replaced by &lt, etc. That text is prepended with "<pre>" and postpended with "</pre>". That ensures that the rendered text preserves all of the white space included in the original file.
Convert html fragment into a valid html document:
This is done by adding template text (from a template file) for a head section and the beginning of the body4. Finally a small piece of template code, read from a template file is added to the end of the html fragment text. At this point the file is viewable in a browser.
Succeeding projects will build, progressively, on work of the prior projects. This first project is intended to be fairly simple, to help you get started with the C++ programming language. The projects that follow will become progressively more challenging. Note that you are not expected to have a lot of experience with building web pages. The small amount of web programming knowledge you need will be discussed in class.

Requirements:

Your Single-User TestHarness Solution:
  1. Shall use Visual Studio 2017 and its C++ Windows Console Projects, as provided in the ECS computer labs.
  2. Shall use the standard streams libraries for all I/O and operators new and delete for memory management.
  3. (2) Shall provide Executive, Converter, and Display packages. You may provide additional packages, as dictated by your design.
  4. (2) Shall accept, from the command line, a path that specifies where file(s) to be analyzed are found, and a regular expression used to select filenames to process.
  5. (1) Should no matches be found, shall write an error message to the console.
  6. (10) Shall, for each matching file, convert the file text, as described in the purpose section, to a valid html file, and save to a folder in your project tree, named "convertedPages".
  7. (5) Shall display, in a child process using the default browser, each converted file, waiting for the child to exit before displaying the next file.
  8. (5) Shall include an automated test that demonstrates you meet all the functional requirements above. Note that this is just a set of tests that show clearly the results of each step of processing you've used to implement this project.
  9. One effective way of implementing this demonstration is to provide a logger, turned off by default. You use the logger to demonstrate each requirement, as part of the program's normal processing. You can turn on logging by providing, on the command line, a predicate that determines whether the demonstration is shown.
Here is a link to the grade sheet used to guide evaluatation of your work.

  1. In C++, a package consists of two source code files, a header (.h) and an implementation (.cpp), that contain:
    • prologue, providing a name, brief descriptive phrase, author information, and environment information
    • description of the package's responsiblities and required files
    • maintenance history
    • class declarations
    • class method definitions
    • a main function that implements construction tests for all the defined code
    The Blocking Queue CodeSnap is a good example.
  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. You won't need to know a lot about programming web pages. We will discuss what you do need to know in class.
  4. A template file contains text that will be copied into files being converted. That text may have selected locations where text is supplied by an argument supplied to the templating process. You can do that by supplying a function "writeTemplate(arg1, arg2, ...)" that inserts argument text into locations defined by some sentinal, e.g., @title, in the template's text.

What you need to know:

In order to successfully meet these requirements you will need to know:
  1. Basics of the C++ language: C++ Reference
  2. How to implement simple classes. This will be covered briefly in lecture #2 and in more detail later.
  3. The standard Containers.
  4. How to use Visual Studio. We will discuss this in one of the Help Sessions.