Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
146777 stories
·
33 followers

Code that fits in a context window

1 Share

AI-friendly code?

On what's left of software-development social media, I see people complaining that as the size of a software system grows, large language models (LLMs) have an increasingly hard time advancing the system without breaking something else. Some people speculate that the context windows size limit may have something to do with this.

As a code base grows, an LLM may be unable to fit all of it, as well as the surrounding discussion, into the context window. Or so I gather from what I read.

This doesn't seem too different from limitations of the human brain. To be more precise, a brain is not a computer, and while they share similarities, there are also significant differences.

Even so, a major hypothesis of mine is that what makes programming difficult for humans is that our short-term memory is shockingly limited. Based on that notion, a few years ago I wrote a book called Code That Fits in Your Head.

In the book, I describe a broad set of heuristics and practices for working with code, based on the hypothesis that working memory is limited. One of the most important ideas is the notion of Fractal Architecture. Regardless of the abstraction level, the code is composed of only a few parts. As you look at one part, however, you find that it's made from a few smaller parts, and so on.

A so-called 'hex-flower', rendered with aesthetics in mind.

I wonder if those notions wouldn't be useful for LLMs, too.


This blog is totally free, but if you like it, please consider supporting it.
Read the whole story
alvinashcraft
48 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

AI-Assisted Coding: Where It Helps and Where It Doesn’t

1 Share
AI-Assisted Coding: Where It Helps and Where It Doesn’t

Discussions about AI-assisted coding are everywhere—and for good reason. The topic tends to stir up a mix of emotions. Some people are curious about the possibilities, some are excited about improving their day-to-day efficiency, and others are worried these tools will eventually get “smart” enough to replace them.

In this article, I will share my own experiences using AI as a coding assistant in my daily workflow.


My Background (and the Tools I Use)

For context, I’m a full stack engineer with 12 years of web development experience. My current focus is UI development with React and TypeScript.

Depending on the project, I use a variety of LLMs and AI tools, including:


Why Context Matters So Much

Regardless of which model you use, getting good results requires preparation. LLMs produce dramatically better output when they’re given sufficient context about:

  • The problem space
  • The tech stack
  • Architectural constraints
  • Coding standards and preferences

For example, if the only instruction provided is:

“Create a reusable React dropdown component”

…the response could reasonably be:

  • A fully custom component with inline styles
  • A ShadCN-based implementation assuming Tailwind
  • A wrapper around a Bootstrap dropdown

Without more information, the LLM has no idea:

  • Which version of React you’re using
  • Whether the app uses SSR
  • How important accessibility is
  • What design system or component library is standard in your project

Many LLMs won’t ask follow-up questions; they’ll just guess the “most likely” solution.


Global Instructions: The Real Productivity Unlock

You could solve this by writing extremely detailed prompts, but that quickly becomes tedious and undermines the efficiency gains AI is supposed to provide.

A better approach is to supply global context that applies to every prompt.

When using AI tools inside your IDE, this often means configuration files like:

  • CLAUDE.md (for Claude)
  • copilot-instructions.md (for GitHub Copilot)

These files are typically generated during a one-time setup. The AI scans the repository and records important assumptions, such as:

  • “This application uses .NET 8.0”
  • “UI components use ShadCN with Tailwind and Radix primitives”
  • “Authentication is handled via Microsoft Entra ID”

You can also manually update these files or even ask the LLM to update them for you.

If you ask for a “reusable React dropdown component” before and after generating these instruction files, the difference in output quality is usually dramatic. The AI can move faster and align with your repository’s conventions.

Tip: It can be beneficial to separate your instructions into smaller, more specific files in a docs folder (auth.md, data-fetching.md, etc), and point to them from your LLM-specific files. This lets you keep a single source of truth, while allowing multiple LLMs to work efficiently in your project.


The Limits of Context (and Hallucinations)

Even with excellent context, LLMs aren’t magic.

They’re still prone to hallucination (confidently producing content that is incorrect or completely fabricated). A common pattern looks like this:

“I understand now! The fix is…”

…followed by code that’s:

  • More complicated
  • Harder to reason about
  • Still incorrect

This leads to the real question:

When is it actually efficient to use LLMs, and what are they best at?

The strengths and limitations below reflect typical, out-of-the-box usage. In practice, the more effort you invest in context, instruction files, and guidance, the better the results tend to be.

Where AI Shines

In my experience, AI is most effective in these scenarios:

  • Quick prototypes, where code quality isn’t the top priority
  • Translating logic from one programming language to another
  • Single-purpose functions with complex logic that would normally require stepping through a debugger

Common examples:

  • Parsing authentication tokens
  • Formatting dates or strings in very specific ways
  • Creating and explaining regular expressions
  • Investigating and narrowing down error causes
  • Writing CSS or Tailwind classes

Styling is a bit of a toss-up. The AI often adds unnecessary styles, but if CSS isn’t your strong suit, it can still be a big help.


Where AI Falls Short

There are also clear areas where AI is far less effective (without additional guidance or setup):

  • High-level architecture and long-term planning
    LLMs don’t naturally think ahead unless explicitly told to, and even then the results often fall short of what an experienced architect would expect.
  • Producing high-quality, maintainable code quickly
    AI can generate a lot of code fast, but well-structured, modular code often takes longer to review and refactor than writing it yourself. I frequently spend significant time cleaning up AI-generated code.

Final Thoughts

After using AI in my everyday work, my conclusion is fairly simple:

AI is excellent at increasing speed and efficiency, but it does not replace good engineering judgment.

On its own, AI tends to optimize for immediacy rather than long-term maintainability. When left unguided, it will readily generate solutions that work today while introducing architectural fragility or technical debt tomorrow. That’s where skepticism is warranted.

That said, well-architected software is achievable with AI when the right conditions are in place. With strong global context, clearly defined architectural constraints, well-maintained instruction files, and, most importantly, a developer who understands what good architecture looks like, AI can become a genuinely effective collaborator.

Used thoughtfully, AI becomes a powerful accelerator. Used blindly, it can become technical debt.



Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Detective Adventures - on debugging UI issues by Oded Sharon

1 Share

Most developers enjoy working on exciting new projects and technologies. It is not only because of the sense of ownership and freedom but it is also about not trudging through old, badly written code filled with technical debt issues no one wants to deal with because they are so dreary. That said, I find satisfaction in looking at an existing system, with all the constraints it entails. And like a detective story, I try to figure out what went on in the previous developer’s mind when they wrote the code that I am now staring at. In fairness, that previous developer is often six-month-ago me, who thought he was very smart when he wrote that code.

A while back a client had a page with a list of documents the user managed. Each row in the table had information about the document and three actions as links - Edit, Delete and Download (PDF). When the client wished to add a couple more actions, we realised the table became exceedingly wide. The design team suggested having a drop-down with the various actions to save space.

The original design: table with links per row

However, the application is a Python form-based application. This means that every action the user submits will cause the page to refresh for the changes to take effect. Previously the “Download” action was a simple link that opened the PDF in a new window. But as the page reloaded, how can we trigger the opening of the new window?

The final design: a drop-down per row

A simple solution would be to include a small inline JavaScript that will trigger the opening of a new window with the PDF. However, the client had an extremely strict security policy, prohibiting inline scripts for security reasons, so that would not work. We produced a different solution - we used a hidden iframe element which triggered the download. The solution seemed great and worked well. However, QA picked up an unexpected issue: If the user downloaded the file and immediately refreshed the page, the form action “download” would be resubmitted, and the PDF would automatically download again. We considered automatically refreshing the page without the auto-download but this had a few issues – it relied on the file being downloaded properly; and it uses a meta-refresh tag which is a big “no-no” in terms of accessibility as the user won’t understand why the page is being refreshed.

We decided to go back to the JavaScript-based solution: catch the form submission event, cancel it, and trigger a download event using the JavaScript (creating a link to the PDF and firing it without ever adding it to the page). It is not the perfect solution as it will leave the 5% of internet users who cannot use JavaScript with the current shoddy iFrame solution, but at least it will improve the experience of the other 95% of the users.

But it did not work. The event listener simply ignored the event when it fired, and the page kept refreshing (making it a pain to debug, as it kept resetting the console). Could it be that the strict content security policy (CSP) prevented writing onclick events? It killed any inline coding attempts with appropriate warning errors. But I could not find any indication that event listening was forbidden.

I needed to find a way to isolate the problem, so I added my own button to the page. Clicking it produced an error message that this button should be inside a form. But why was JavaScript complaining about it?

It turned out that the system user had a bad habit of double-clicking buttons (picked up from the old desktop version of the product) and for a Python application, it caused the form to be submitted twice. The user would get to see the result of the second submission, which failed as “The form was already submitted.” The crude solution for this problem was to catch any form submission, cancel the event, turn the clicked button into a hidden field, disable all the buttons, and submit the event again. The reason for the hidden field is because disabled buttons’ values are not being sent as part of form submission.

It was this piece of code (adding the hidden field to the button’s form) that triggered the error in my experimental button and that is how I found it. It is worth pointing out that the product barely relies on JavaScript; it is using webpack to create a single file that is applied to every page in the system, including the “documents” I was now trying to fix.

At this point, the solution was easy – I replaced the “double-click-protection” with a simple debounce mechanism (which prevents sending events too frequently), allowing my event to still run properly and get caught by my own event listener.

Alternatively, I could’ve added a condition to the “double-click-protection” code to check if the button has an attribute double-click-protection="false"; add that attribute to my button that I can now listen to using JavaScript and send the PDF, as I originally planned. It would have been a simpler, safer way to do it (less breaking of existing code), but I felt it would just patch over instead of actually solve the problem.

Alternative design: some links available, some hidden behind "..."

Another suggestion we have considered was to use HTML-based summary/details elements to show/hide the secondary actions, thus eliminating the need for JavaScript. Unfortunately, the design team was not in favour of this solution due to time constraints on their part.

There is a key takeaway about the difference between form-based applications (server-side rendering for that matter) and web-based applications. The former is extremely limited in its capabilities, and I can see why designers would find it too restricting. Personally, I find that it forces a certain simplicity in keeping a minimalistic client-side code that is healthy for code maintenance as well as the user’s mental model.

Conclusion

The landscape of software development is constantly changing, with modern technologies, frameworks, and methodologies. This, as I have mentioned in the past, can be quite overwhelming for junior developers. I hope that this experience I have shared gives a better view on the type of problems we are dealing with. As developers, we are required to understand the client needs and produce the best software, regardless of the tech stack.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

0.0.401-0

1 Share

Added

  • Add copilot login subcommand and support ACP terminal-auth
  • Add agentStop and subagentStop hooks to control agent completion

Fixed

  • CLI handles unknown keypresses gracefully
  • /diff displays accurate line numbers with dual column layout
Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Control vs. Innovation - The Two Forces Behind Every RTO Decision

1 Share

The return-to-office debate has been hijacked by the wrong conversation. In this episode, Josh and Bob cut through the noise to reveal what's really driving RTO mandates—and it's not what most leaders will admit.

There are two clouds hovering over every in-office decision: the Control Cloud and the Innovation Cloud. The Control Cloud is about distrust, micromanagement, and leaders who feel uneasy when they can't physically see butts in seats. The Innovation Cloud is about something entirely different—creating the conditions where teams can do their absolute best work together.

Drawing from decades of experience building high-performing teams at companies like iContact, Teradata, and EMC, Josh and Bob make the case that co-located teams aren't just a preference—they're an innovation multiplier. They share stories of conference rooms turned into collaboration bootcamps, cube walls torn down with power drills, and the simple magic of a room erupting in applause when someone moves a sticky note to "Done."

But this isn't about forcing people back to the office for control. It's about understanding what gets lost when we optimize purely for individual convenience over team collaboration. The watercooler conversations. The yelps from a frustrated tester that bring immediate help. The face-to-face tension that drives real innovation.

Josh, who has debated this question with himself for fifteen years, finally lands on an answer: if he were building a team from scratch today, he'd build a co-located team of collaborative problem solvers. Not because remote can't work, but because the magic of true team collaboration is worth the commute.

The question isn't whether you should return to office. The question is: which cloud is driving your decision?

Stay Connected and Informed with Our Newsletters

Josh Anderson's "Leadership Lighthouse"

Dive deeper into the world of Agile leadership and management with Josh Anderson's "Leadership Lighthouse." This bi-weekly newsletter offers insights, tips, and personal stories to help you navigate the complexities of leadership in today's fast-paced tech environment. Whether you're a new manager or a seasoned leader, you'll find valuable guidance and practical advice to enhance your leadership skills. Subscribe to "Leadership Lighthouse" for the latest articles and exclusive content right to your inbox.

Subscribe here

Bob Galen's "Agile Moose"

Bob Galen's "Agile Moose" is a must-read for anyone interested in Agile practices, team dynamics, and personal growth within the tech industry. The newsletter features in-depth analysis, case studies, and actionable tips to help you excel in your Agile journey. Bob brings his extensive experience and thoughtful perspectives directly to you, covering everything from foundational Agile concepts to advanced techniques. Join a community of Agile enthusiasts and practitioners by subscribing to "Agile Moose."

Subscribe here

Do More Than Listen:

We publish video versions of every episode and post them on our YouTube page.

Help Us Spread The Word: 

Love our content? Help us out by sharing on social media, rating our podcast/episodes on iTunes, or by giving to our Patreon campaign. Every time you give, in any way, you empower our mission of helping as many agilists as possible. Thanks for sharing!





Download audio: https://episodes.captivate.fm/episode/ba30e412-506e-487d-b028-a5f567c8d9f2.mp3
Read the whole story
alvinashcraft
2 hours ago
reply
Pennsylvania, USA
Share this story
Delete

975: What’s Missing From the Web Platform?

1 Share

Scott and Wes run through their wishlist for the web platform, digging into the UI primitives, DOM APIs, and browser features they wish existed (or didn’t suck). From better form controls and drag-and-drop to native reactivity, CSS ideas, and future-facing APIs, it’s a big-picture chat on what the web could be.

Show Notes

Sick Picks

Shameless Plugs

Hit us up on Socials!

Syntax: X Instagram Tiktok LinkedIn Threads

Wes: X Instagram Tiktok LinkedIn Threads

Scott: X Instagram Tiktok LinkedIn Threads

Randy: X Instagram YouTube Threads





Download audio: https://traffic.megaphone.fm/FSI4087578092.mp3
Read the whole story
alvinashcraft
2 hours ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories