Reaves.dev

v0.1.0

built using

Phoenix v1.7.12

Software Architecture Text Browser

Stephen M. Reaves

::

2023-08-23

Notes about Lesson 1 of CS-6310

Summary

Problem

Imagine you are building a text browser.

Components

What components would you need from a GUI library?

We also need a component to supply the text

ViewPort

ScrollBar

Use Cases

Imagine how the user will use the intended solution

Analyisis Model

We will be using UML

Exercise

Create a diagram with classes for the three components we’ve identified

Gvp ViewPort + Height+ FirstLine+ Close+ Resizesb ScrollBar + TraySize+ HandleSize+ HandlePosition+ Scroll+ Resizevp:height->sb:tsvp:fl->sb:hpvp:rs->sb:rsfm FileManager + StartingDirectory+ GetLines+ FileInfofm:fi->sb:hs

Apparently I was only supposed to fill it in with names and not like attributes and operations, but whatever I’m leaving it

Operation

Operations comprise those actions that the user can undertake to interact with the application.

Can provide parameters and return types

Attributes

Attributes are things entities own/have

Percepts are attributes that the user can see

FileManager

Not visible to the user

Supplies contents of the file

TextBrowser interacts with the file system through operating system

Document is a percept that is supplied by the operating system actor

Relationships

3 types

Gsb Scrollbar + handleSize : int+ handlePosition : int+ MoveHandle(newPosition : int) : voidfm FileManager + document : sequence(lines) vp ViewPort + height : int+ viewContents : sequence(lines)+ resizeWindow(newSize : int) : voidfm--vpLinesVisible
context LinesVisible inv:
  ViewPort : viewContents->size() = ViewPort : height.min(FileManager : document->size())
func LinesVisible(vp ViewPort, fm FileManager) {
  vp.viewContents.size = Min(vp.height, fm.document.size)
}
Gsb Scrollbar + handleSize : int+ handlePosition : int+ MoveHandle(newPosition : int) : voidfm FileManager + document : sequence(lines) vp ViewPort + height : int+ viewContents : sequence(lines)+ resizeWindow(newSize : int) : voidfm--vpLinesVisibledDisplaysd--sbd--fmd--vp
context displays inv:
  let topLineNumber = Scrollbar : handlePosition *
    FileManager : document->size()
  in ViewPort : viewContents = FileManager :
    document->subsequence(topLineNumber, topLineNumber + ViewPort :
    viewContents->size() -1)
Gsb Scrollbar + handleSize : int+ handlePosition : int+ MoveHandle(newPosition : int) : voidfm FileManager + document : sequence(lines) vp ViewPort + height : int+ viewContents : sequence(lines)+ resizeWindow(newSize : int) : voidfm--vpLinesVisibledDisplaysd--sbd--fmd--vphpHandleProportionhp--sbhp--fmhp--vp
context scalesHandle inv:
  Scrollbar : handleSize = ViewPort : viewContents->size() / FileManager : document->size()