Merge pull request 'chore: Update blog and improve layout responsiveness`' (#13) from develop into main
Reviewed-on: #13
This commit is contained in:
commit
9cee52b55b
4 changed files with 66 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -30,3 +30,4 @@ pnpm-debug.log*
|
|||
|
||||
# jetbrains setting folder
|
||||
.idea/
|
||||
.agent-shell/
|
||||
|
|
|
|||
46
src/blog/2026-02-23-the-principles-of-programming-review.md
Normal file
46
src/blog/2026-02-23-the-principles-of-programming-review.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: 'Returning to Programming Principles in the Age of AI'
|
||||
pubDate: 2026-02-23
|
||||
author: 'Nakahara Daisuke'
|
||||
tags: ["Book", "programming"]
|
||||
---
|
||||
|
||||
In this article, I will organize and reflect on the key insights from ["The Principles of Programming: 101 Timeless Principles Every Developer Should Master by Year 3"](https://www.shuwasystem.co.jp/book/9784798046143.html) by Isao Ueda.
|
||||
|
||||
As I approach my third year as a developer in April, and with the growing responsibility of reviewing code generated by AI models, I felt it was the right time to revisit and deepen my understanding of fundamental programming principles. This book proved to be an excellent resource for that purpose.
|
||||
|
||||
In this review, I will organize my findings from three perspectives: "principles the author emphasized as important," "areas I need to be careful about," and "new knowledge I gained," while introducing some key points from each category.
|
||||
|
||||
## Principles the Author Emphasized as Important
|
||||
|
||||
- The most critical aspect is making code readable with the understanding that change is inevitable.
|
||||
|
||||
## Areas I Need to Be Careful About
|
||||
|
||||
- Never write code simply because you want to use a newly learned technology. Code is not a place to demonstrate your intelligence.
|
||||
- Keep code to only what is necessary right now. Prioritize simplicity over generality.
|
||||
- Minimize output messages to only the most important information. Messages like "Application is starting" or "Application is terminating" are meaningless.
|
||||
- Use shell scripts as a glue language to increase leverage and portability. Resist the temptation to use compiled languages you regularly work with as a glue language.
|
||||
|
||||
## New Knowledge I Gained
|
||||
|
||||
- Place "logic" and "the data that logic manipulates" close together in your code structure.
|
||||
- Start prototyping as early as possible.
|
||||
- Aim for modules with high independence by ensuring all instructions within a module are related to executing a single role or function (functionally cohesive modules).
|
||||
- Write "defensive" code that protects other parts of the system even when invalid data is passed to a function, regardless of where the problem originated.
|
||||
|
||||
Recently, thanks to generative AI, I have far fewer opportunities to write code myself. In this context, mastering the principles presented in this book and using them to guide AI models toward generating the code I expect has become one of the critical skills for modern developers.
|
||||
|
||||
As I was writing this article, Claude Sonnet 4.6 suggested to me an example of an effective prompt based on programming principles. The following structure proved particularly valuable:
|
||||
|
||||
"Implement a user authentication feature. Follow these principles:
|
||||
- Single Responsibility: Separate authentication logic from input validation
|
||||
- Defensive Code: Include appropriate error handling for invalid or unexpected data
|
||||
- Simplicity First: Prioritize minimal necessary implementation
|
||||
- Logging: Only log errors and critical results; exclude verbose status messages"
|
||||
|
||||
By constructing instructions around these principles, the essence of prompt engineering becomes clear. As I enter my third year as a developer, I am grateful to have read this book and gained these insights.
|
||||
|
||||
---
|
||||
|
||||
> **Note**: The review and translation were assisted by an AI generative model. The author is responsible for the final content.
|
||||
|
|
@ -35,7 +35,7 @@ const { pageTitle } = Astro.props;
|
|||
{pageTitle}
|
||||
</h1>
|
||||
<slot />
|
||||
<Footer>
|
||||
<Footer />
|
||||
<script>
|
||||
import "../scripts/menu.js";
|
||||
</script>
|
||||
|
|
@ -44,6 +44,6 @@ const { pageTitle } = Astro.props;
|
|||
|
||||
<style>
|
||||
.page-title {
|
||||
font-size: 2.8rem;
|
||||
font-size: 2.2rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,3 +1,16 @@
|
|||
document.querySelector('.hamburger').addEventListener('click', () => {
|
||||
document.querySelector('.nav-links').classList.toggle('expanded');
|
||||
});
|
||||
const setupHamburgerMenu = () => {
|
||||
const hamburger = document.querySelector('.hamburger');
|
||||
const navLinks = document.querySelector('.nav-links');
|
||||
|
||||
if (!hamburger || !navLinks) return;
|
||||
|
||||
hamburger.addEventListener('click', () => {
|
||||
navLinks.classList.toggle('expanded');
|
||||
});
|
||||
};
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', setupHamburgerMenu);
|
||||
} else {
|
||||
setupHamburgerMenu();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue