Introduction to Software Engineering
or how to JOYFULLY BUILD with a TEAM
Prof. Jérémie Lumbroso, Ph.D.
lumbroso@seas.upenn.edu
LECTURE 4:
Code Archeology
⚠️➡️ RIGHT NOW, go to https://sli.do
Code #23232323
A scifi author imagines how a civilization in a thousand years might read our code written today
Unix Epoch (start): 00:00:00 UTC on January 1, 1970
Purpose: Acts as the reference point for time in Unix-like systems
Measurement: Time stored as the number of seconds elapsed since this epoch
Moon Landing: In July 20, 1969, Neil Armstrong and Buzz Aldrin are the first men to walk the moon (Apollo 11 mission)
C.S. professor (died March 2024), author of many sci-fi novels, he popularized the notion of technological singularity.
Original
Student work
Student work
Student work
Student work
Student work
Sample HW1 From Spring 2024
"Programming Archaeology is about diving into an existing codebase—where everything's in place, but you don't know exactly how."
What's Special About Hugo and a Static Site?
hugo server
can live-reload changes—perfect for exploring code step by step. hugo server
to see live results of your changes.When diving into any codebase, especially for the first time, keep these principles in mind:
You Won’t Understand It All
Be Systematic
README.md
), then systematically investigate files and directories.Work Iteratively
Document as You Go
_index.md
differs from a typical content file, or how front matter influences build behavior. We will see that the principle here apply to any codebase.
grep
or ag
to find relevant pieces. hugo server -D
to see draft posts, watch for errors. config.toml
or .yaml
with site configs. themes/hugo-bootstrap-theme/
(or whichever theme you chose). Key Tip: Try to see how "content" maps to "layouts" by looking at the theme's partials and searching for references to them in your _index.md
or config.toml
.
themes/hugo-bootstrap-theme
and see hundreds of SCSS, partials, shortcodes, etc. hugo server
.hugo
command, which reads config.toml
and scans content/
. node_modules/
if the theme uses them. content/
folder and layouts/
. themes/hugo-bootstrap-theme/
.Start with the Official Docs
Peek at the Project’s README.md
Cloning, Building, and Running
git clone <the-hugo-theme>
and see if there’s a package.json
that requires npm install
. hugo server
or npm run dev
—does everything build? If not, read any build errors carefully. Look for Where to Insert Content
_index.md
drives the homepage content. themes/theme-name/layouts/
. The _default/
folder often has baseof.html
, single.html
, list.html
. header.html
, footer.html
) are in partials/
.Use Your IDE and Text Search
nav
, header
, hero
) across the code helps locate the partial that controls the top banner. Make Small Changes
<p>
in a partial to confirm you’ve found the correct place. Review the “Front Matter” Requirements
draft = true
, title
, tags
). landingPagePromoImage
), you can add them to front matter and reference them in your layouts.Document Findings
themes/mytheme/layouts/partials/hero.html
.” hugo server
; confirm no errors. "Experts do not try to think about everything at once. When faced with a complex problem, experts often solve a simpler problem first, one that addresses the same core issue in a more straightforward form. In doing so, they can generate candidate solutions that are incomplete, but provide insight for solving the more complex problem that they actually have to solve."
Tip 1: Start by editing text in one .md
file, confirm your build, then proceed to more complex tasks (like altering SCSS or partial templates).
Tip 2: If you're stuck, define an even smaller subproblem—like changing just the site title—before tackling the entire homepage layout.
Recommended Tools: Markdown preview (VS Code), hugo server --verbose
to see immediate feedback.
"Experts have no desire to ‘reinvent the wheel’. If they have a solution that works, or know of one elsewhere, they will adopt that solution and move on to other parts of the design task. Of course, they know to re-assess the existing solution within the context of the current project, to make sure that it actually fits. As long as it does, and as long as it is legally and ethically allowed, they choose to borrow rather than build, reuse rather than re-implement, and copy rather than draft."
exampleSite
folder likely has references, partials, and standard content structures. Reusing them can save time. grep
(or ag
) or your IDE's "Find All References" to see if the code snippet you're about to copy is widely used or specialized. blame
can reveal who wrote a snippet, and sometimes why.Ctrl+Shift+F
(Windows) or Cmd+Shift+F
(macOS) to find where a snippet occurs. themes/*
if you want to focus on your local site files first; or include it if you suspect the logic is in the theme.hugo server -v
(verbose) if you need logs. "In the same way that architects walk cities to examine and take inspiration from existing buildings, software experts examine the designs of other software to ‘see how they did it’. They frequently do so in response to a particular challenge they face, but they often also spend time looking around just to add to their repertoire of possible design solutions to draw upon in future."
.html
partials side by side to compare patterns for different pages (like "site-header.html" vs. "site-footer.html"). layouts/_default/single.html
layouts/partials/
for small reusable chunks archetypes/
folder for default front matter if you run hugo new
commandsObservation: If your theme has a pattern, replicate it for new features (e.g., if it uses shortcodes for call-to-action banners, copy the existing pattern for your new "feature highlight").
A typical Hugo project may look like this:
└── my-portfolio
├── config.toml
├── content
│ ├── _index.md
│ ├── about.md
│ └── blog
│ └── first-post.md
├── layouts
│ └── ...
├── static
│ ├── images
│ └── css
└── themes
└── my-hugo-theme
├── layouts
├── assets
├── static
└── ...
config.toml
: Site-wide configuration (e.g., site title, baseURL). content/
: Markdown files that hold actual site text. layouts/
and themes/
: The architectural heart. Houses templates, partials, and the scaffolding that stitches content to rendered pages. static/
: Unprocessed assets (images, CSS, JS).In your homework, you’ll have to figure out where to make changes so that the site’s final design (like your “fake landing page” for your “fake product”) matches specs.
"Experts sketch when they think. They sketch when alone. They sketch in meetings with colleagues or clients. They sketch when they have no apparent need to sketch. They sketch on paper, on whiteboards, on napkins, in the air. Experts know that sketching is a way to interact with their own thoughts, an opportunity to externalize, examine, and advance what they have in their minds."
NOTES.md
in your repo). From Andrew Lindesay - Software & Data Engineering
NOTES.md
. Theme Dependencies:
npm install
(for SCSS, PostCSS, etc.).Base URL / config.toml:
baseURL
can lead to broken images. Front Matter:
---
) or correct parameters.Search & Replace Mistakes:
Node-sass / SCSS Issues:
Theme Asset Compilation
npm run build
or gulp build
. npm install
.Partial Overriding
Content Not Showing
draft
is set to true. Or your _index.md
file is in the wrong folder (like content/index.md
instead of content/_index.md
). Permalink or URL Issues
baseURL
in config.toml
is incorrect. http://localhost:1313/...
when you want relative links."Design regularly involves error: things that 'go amiss’, misunderstanding, obstacles, wrong turns, emergent issues. Rather than fearing error, experts embrace error as opportunity. They accept it as an inherent part of design and take time to explore both the failure and the context around it. Understanding what happened often reveals insights about the problem – or about the solution – such as assumptions, misconceptions, misalignments, and emergent properties."
--debug
or -v
flag can add detail to your error logs. LLMs such as ChatGPT, Claude or DeepSeek are very good at make error messages explicit if you find on cryptic.NOTES.md
) for yourself and future students. COBOL (1959): Among the oldest high-level languages still in use, primarily in finance, government, and administration.
Why It Matters: Despite its age, COBOL underpins critical systems worldwide—but finding experts to maintain it is getting harder.
COBOL systems are deeply ingrained in critical infrastructure and remain functional, leading many organizations to keep them rather than replace them.
As COBOL experts retire, a looming skills gap endangers the stability of crucial applications running on legacy systems.
The 2020 unemployment surge highlighted how vulnerable essential services can be when they rely on decades-old, under-maintained COBOL systems.
Organizations can either modernize legacy systems or invest in COBOL training—but doing nothing increases the risk of critical failures.
COBOL’s persistence underscores how “old” doesn’t always mean “obsolete.”
It highlights the importance of software archaeology—understanding and maintaining legacy code to ensure the continued stability of society’s most essential services.