17-313:
SOFTWARE ARCHAEOLOGY
TA Nour Ali
Reminders
Documentation - PLEASE
GOAL:
Figure out how a system works
To fix the system
To add features to the system
To build a similar system
To evaluate the system
Software constantly changes
Software is easy to change!
Software is a redundant mess
You can copy something and use it as a starting point
At a high level you want to …..
Develop a working model —an understanding of the components of a system and connections between them
Model–view–controller
directly manages the data, logic and rules of the application
representation of information
Accepts input and converts it to commands for the model or view
VISUALIZE
SEARCH
READ
How to approach a codebase:
DO
01
02
03
04
Modules, classes, function calls
Tutorials, documentation, readme
Keywords, grep, find
Build, run, change, run
Static Information Gathering
Dynamic Information Gathering
READ
SEARCH
find
Terminal command to search for files and directories
% find start whattolookfor
-name File name
-type Specify type, i.e. files/dirs
% find . -name index.html
% find ./src -name '*.html'
% find ./src -type f
grep
Terminal command to search for words in files
% grep 'word' filename
-i Case-insensitive
-r Recursive search
% grep 'meta' index.html
% grep -r --include='*.java' "hello" .
VISUALIZE
Modules
Classes
Function Call Graph
DO
Hint #1
Every change you make: must rebuild and start → takes time!
Using Grunt: will automatically update instead of rebuilding for each change
Hint #2
Some problems throw hidden errors.
Go to setting → Developer tools → console
Hint #3
Where is a good place to start?
What should we search for?
grep -r "Username taken"
grep -r "username-taken"
grep -r "username-taken" --exclude-dir=language
Hint #4
We want to change the error message from 'Username taken' to 'Username taken. Maybe try ${currentUsername}suffix'.
This involves transforming a constant error message into a template error message.
How do we edit the error string based on the user’s input?
Has something similar been done somewhere in the code?
Look at other error messages!
THANK YOU!