diff --git a/.gitignore b/.gitignore index 632e837..71d4b48 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ pnpm-debug.log* # jetbrains setting folder .idea/ +.agent-shell/ diff --git a/src/blog/2026-02-23-the-principles-of-programming-review.md b/src/blog/2026-02-23-the-principles-of-programming-review.md new file mode 100644 index 0000000..b4faba2 --- /dev/null +++ b/src/blog/2026-02-23-the-principles-of-programming-review.md @@ -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. diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 0837182..4b5be2b 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -35,7 +35,7 @@ const { pageTitle } = Astro.props; {pageTitle} -