Reading 4: Premature Optimization & AI-Generated Fragility

Due: 2026-12-04 11:59 PM PT
Released: 2026-11-29

Read the following two blog posts. After reading, answer the three questions below about your project so far, in about 250-400 words, and then discuss the articles with your classmates in a shared Google Doc.

Optionally done with your project group

You may optionally write the response (part 2) with your CHIP 10.5 project group, or you may write it on your own.

  • If you complete it as a group, the group writes one Google Doc response, and every member submits that same Google Doc URL.
  • Every member must still read both articles, and each individual must still write their own comments on the articles (part 3).
  • Everyone must individually make their own Gradescope submission. There is no group submission on Gradescope.

1. Read

Read the following two blog posts (every student, even if you are writing the response as a group):

2. Response (individual, or optionally with your project group)

Both posts are about choices that feel productive in the moment and cost you later: speeding up code nobody measured, or accepting code nobody fully understands. You have now finished two iterations on a real, inherited codebase, and you are in the middle of Iteration 3, so answer these questions about your project, not projects in general.

  1. Measure before you optimize. Berkopec argues that “any optimization that does not come from observed measurement, usually in production, is premature,” and that 80% of an app’s work happens in 20% of its code. Pick the page in your deployed app that your users rely on most and measure it: for example, the Completed 200 OK in ...ms (Views: ... | ActiveRecord: ...) lines in your server logs, or the Network tab of your browser’s dev tools. Report the numbers. Where does the time actually go, and is there a “20%” worth fixing? Has anyone on your team changed code to make it faster, cleaner, or “more scalable” in Iterations 1 or 2 without measuring first? In hindsight, was it worth it?
  2. Where is your codebase fragile? Merz lists four ways that AI use makes a codebase fragile: it “writes shallow tests” that leave gaps “invisible to developers because they aren’t captured by the line level coverage metric,” it writes overly complex code, it decreases human understanding of the codebase, and it “moves too quickly for human developers to maintain a high quality bar.” Look back at your pull requests and git log from Iterations 1 and 2. Find one concrete example of fragile code in your project: something that broke when a teammate changed something nearby, that nobody on the team could confidently explain in review, or that everyone is now afraid to touch. Was it written with AI help, by hand, or inherited from the legacy starter code? What made it fragile (missing or shallow tests, duplicated logic, a pattern that doesn’t match the rest of the app)? Which of Merz’s four causes, if any, does it match? Do you agree with Merz that AI was the cause, or was it how your team used and reviewed it?
  3. Plan for Iteration 3. In Iteration 3 your team extends its Iteration 2 feature and builds one custom feature of its own choosing. For your custom feature, describe what evidence you will use to keep it from becoming either a premature optimization or a fragile one: a measurement before and after, the tests that must exist before you merge, or a review rule for AI-generated changes. Name one practice your team will change from Iterations 1-2 because of these articles, and how you will know at your Iteration 3 retrospective whether it worked.

Your answers should point to specific pages, files, pull requests, commits, or numbers from your project.

You should expect to write 2-3 paragraphs and about 250-400 words. We will mark submissions off which are significantly longer or significantly shorter, but we do not intend to precisely check word counts.

Please write your response in a Google Doc, and share this document with cs169@berkeley.edu as an editor. If you are writing as a group, write one Google Doc together, list every group member’s name at the top, and make sure every member contributes.

Please declare any uses of AI or collaboration below your response.

These responses will be submitted to Gradescope, but not shared publicly.

3. Question, Quote, Comment, Response

In one of 3 Google Drive folders which has been shared with you (find your group by team number below), please add a comment to the shared document, one for each article. Comments are individual: even if you wrote the response as a group, each person writes their own comment on each article. You should assume that about 35-40 others in the class will read your comments.

Google Drive Links

Please do not request access to other groups’ folders. We will not approve them.

To add a comment, select the text, then right click and click the little “+” icon, or press Command-Option-M (on Mac) or Control-Alt-M (on Linux or Windows).

In your comment, you may pose a substantive question, quote from your writing, or respond to another student’s comment. A good comment shares something specific from your project that other teams can learn from. Comments don’t necessarily have a minimum or maximum length, but should be meaningful. I.e., “I agree!” is not enough, but you need not write an entire paragraph.

You should leave one comment on each document in the shared folder.

4. What to Submit

Everyone must individually make their own Gradescope submission to the assignment linked under Submission, worth 10 points. If you wrote the response as a group, every member submits the same Google Doc URL and the same PDF, along with screenshots of their own comments. In your Gradescope submission you will include:

# Item Points Grading
1 The URL to your Google Doc (the same URL for every member, if written as a group) 1 0 points for no or inaccessible submissions; 1 point for a Google Doc that cs169@berkeley.edu can access as an editor
2 A PDF upload of your response 6 Question 1: 0 / 1 / 2 points; Question 2: 0 / 1 / 2 points; Question 3: 0 / 1 / 2 points
3 A screenshot of your own comment on article 1, “Why Premature Optimization is Bad” 1.5 0 / 0.75 / 1.5 points
4 A screenshot of your own comment on article 2, “AI Usage Generates a Fragile Codebase” 1.5 0 / 0.75 / 1.5 points
5 Links to AI chats: an open-ended text box to share URLs of how you used AI 0 Not graded

10 points total. For each graded item:

  • No credit for a missing or very low effort submission, or one which reads entirely as from a language model.
  • Half credit for submissions which show marginal effort or thought, but for which not much time was spent, or which talk about projects in general rather than your project.
  • Full credit for submissions which attempt to fully answer the questions with specific evidence from your project.

AI Use Policy

This assignment follows the course AI Policy, which will be published on this site before it is needed. Until then, the rule from the Syllabus applies: you must be able to explain everything you submit.

You may not use AI to do any of the writing for you. You may not have AI think for you, nor should you ask it to summarize the articles. (They really only take 10-15 minutes to read.)

You may use AI tools to help you dig through your own project, e.g. to find where a slow query comes from or to summarize your git log, the same way you would use grep or your editor. Anything you claim about the project should point to something you or a teammate actually looked at: a commit, a pull request, a log line, or a measurement.

You may use tools like Grammarly to proofread. Please declare any uses of AI or collaboration below your response, and share links to any AI chats in the last question on Gradescope.

Submission

This is a Gradescope online assignment: you answer the questions directly on Gradescope. There is no code to upload and no autograder to wait for. You may save and resubmit your answers as many times as you like before the deadline; only the final submission will be graded.

Back to Top

Accessibility Nondiscrimination

Copyright ©2026, Regents of the University of California and respective authors.

This site is built following the Berkeley Class Site template, which is generously based on the Just the Class, and Just the Docs templates.

View all course offerings