schmonz.com is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.
This server runs the snac software and there is no automatic sign-up process.
Welcome to the Leanpub Launch video for Craft Your Code: Mastering the Foundations of Code Quality in the Era of AI Assistants, Second Edition by Srihari Sridharan!
Watch & read on the Leanpub blog here:
#books #leanpublishing #selfpublishing #booklaunch #coding #programming #softwareengineering #career #refactoring #nodejs
Leanpub Book LAUNCH 🚀 Craft Your Code: Mastering the Foundations of Code Quality in the Era of AI Assistants, Second Edition by Srihari Sridharan
Watch here:
#books #leanpublishing #selfpublishing #booklaunch #coding #programming #softwareengineering #career #refactoring #nodejs
Here's a list of 10 different refactoring techniques for you to leverage!
Read more here:
https://www.devleader.ca/2023/11/14/top-10-refactoring-techniques-you-need-to-transform-your-codebase/
These models are used in literally thousands of places in the project - they're truly the heart of the system. And this weekend I am attempting a major heart surgery to rewire them.
This includes standard migrations, data migrations, and lots and lots of refactoring throughout the project.
Terrifying stuff.
Wish me luck 😬
3/3
Table of Contents
For two days I have been migrating my blog from Hugo to Eleventy via the markdown pages, and the photos via Ghost Export for WordPress. In the process I achieved a goal, and then AI broke things, so I achieved them again, and then AI broke them again.
The favourite thing for Ai, and Gemini, in particular to break was the logic that took the markdown titles, matched them to a json file, and then helped 11ty marry the photo with the correct post. When it worked it was brilliant, but when it broke I would spend half a day trying to fix it. By the third time this happened I decided to ask Gemini to help me write a script to hard code the image path straight into markdown pages.
That step was a resounding success. The logic is simple. AI is great for a simple question, but as soon as you start a russian doll/inception of steps the context window, or scope window, to use a programming term gets confused.
I saw the term context window used, but I'd like to experiment with scope and AI. Specifically I'd like to document how it behaved when I saw that the eleventy.js file was getting too long, and I asked Gemini to refactor it. The first mistake was to accept that Gemini could do this in just two steps. Step 1, filters.js, and then step 2 for another set of logic.
Now, in an ideal world, AI would know what it did, see the code, determine what each part does, and tidy everything up into neat refactored niches. It didn't do that. Remember that mention of the image logic being lost three times? The third time was due to refactoring.
To be specific, Gemini took the complex logic for matching thumbnails to posts and replaced it with two lines of irrelevant code, that I noticed eventually, as I tried to debug why the refactoring had failed.
When I noticed that Gemini has issues with keeping within the scope of a question I decided to use git. Every time Gemini provided me with a solution that worked I'd commit it. The logic is that if it breaks something I can tell it "This is how things were, and this is how they are now. I'd like to fix things".
In my experience AI is fantastic as spitting out code, and muddling contexts, but very bad at answering "Can you remind me which command we used to do that", whereas git is fantastic at that, if you're efficient about git commit comments that mean something to you.
If AI makes a mistake, either because your instructions were not clear or because it got confused, asking another question will muddle it even further. Imagine an AI chat as a sand pit by the sea. The more you chat, the deeper the hole you dig. Eventually you make a mistake, and the tidal waters begin to flow into your sandpit. Within seconds that chat is swamped and unusable. With AI it's good to have a bug out bag ready. "Now that this context is hallucinating let's move to a new one".
If you're working on an eleventy blog and you're adding functionality, one step at a time, it's good to add bookmarks in the form of git commits. You use Gemini, or your favourite LLM to write the function, and once it works you bookmark it. You then write the next, and bookmark that. Eventually, when the LLM, or you, makes a mistake, and the LLM hallucinates or starts muddling scopes, you just start with a clean slate, helped by git, and continue moving forward, with a minimum of hassle.
Next time I refactor I won't ask "can you refactor this long eleventy.js file?" I will break into stages. I like that Gemini refactored the functions into two files based on function type. I made the mistake of not checking that it preserves the logic of the function while refactoring. Be explicit.
With the thumbnails and featured images logic I assumed that once the logic worked, it would be permanent. It isn't. It can easily change. When I told Gemini to use the logic, and move the image paths directly into the markdown files I simplified my life. Complex logic could be removed from eleventy, and posts could go with a standardised approach to displaying images. Simplification works.
Use git to help you keep track of changes. AI is not a search engine, so don't rely on it to remember a solution it provided for you. It will come up with a new one. Be as concise as possible and keep the context window small. The larger it is, the more room there is for mistakes.
And finally, AI might be logical and rational but it doesn't have an understanding of what it is doing. To use the Short Circuit analogy "A machine doesn't have emotions, or feel, it only runs as programmed". AI is Not Number five. AI is a tool. That's why it's good to practice with using it properly.
#11ty #AI #context #eleventy #javascript #js #refactoringI've been training many teams around coding, design, and refactoring this past year, and here are three things I repeat often:
Fix the small things, particularly during training. Learning to be super fast at fixing the small things prepare you for when the big things will come. In that, when big things arrive, the small things will never be an issue, you can deal with them on autopilot and save your energy for the big things.
1/3
Refactoring : If you run the tests often: everytime it breaks, it has to be what you just did. Diagnostic is super easy. If you run the tests at the end only: if it’s broken, you have no idea why and you have to look everywhere. Check early, check often.
2/3
My preference: start slow, finish fast with confidence. Rather than start fast, finish slow with a lot of things to fix.
Bonus:
Refactoring is also knowing when to stop.
3/3
The only solution to tech debt is to go fix all of it right away.
Read more here:
https://www.devleader.ca/2023/10/20/how-to-balance-technical-debt-tackle-it-before-it-tackles-you/
You know you're old when... someone cites a concept and both cites and shows the book that is influential in this space... this is good... but the book they show is the second edition, when your point of reference for the same concept is the same book... but the first edition... that is (personally) not so good 🙄
#Refactoring
We organise in the open, and you're very welcome to chat with the organisers to help, ask questions, give feedback, or simply to watch. You can reach us on the #ev_socratesuk slack channel (https://slack.softwarecrafters.org/), or on mastodon, LinkedIn, BlueSky, or by emailing organisers at socratesuk dot org.
We organise in the open, and you're very welcome to chat with the organisers to help, ask questions, give feedback, or simply to watch. You can reach us on the #ev_socratesuk slack channel (https://slack.softwarecrafters.org/), or on mastodon, LinkedIn, BlueSky, or by emailing organisers at socratesuk dot org.
Thanks to all the #DevNexus folks who attended my #Java talk on #Refactoring in #IntelliJIDEA (mostly) without AI.
Slides are available here: https://ted.dev/talks/#past-talks
Want this talk (or other ones) at your group event or conference, let me know!
ReSharper for Visual Studio Code, Cursor, and Compatible Editors Is Out
#dotnet #resharper #vscode #cursor #programming #refactoring #codingstandards
RE: https://discuss.systems/@SoCraTes_UK/116165956780268806
really excited to be going to this…
We organise in the open, and you're very welcome to chat with the organisers to help, ask questions, give feedback, or simply to watch. You can reach us on the #ev_socratesuk slack channel (https://slack.softwarecrafters.org/), or on mastodon, LinkedIn, BlueSky, or by emailing organisers at socratesuk dot org.
We organise in the open, and you're very welcome to chat with the organisers to help, ask questions, give feedback, or simply to watch. You can reach us on the #ev_socratesuk slack channel (https://slack.softwarecrafters.org/), or on mastodon, LinkedIn, BlueSky, or by emailing organisers at socratesuk dot org.
Can be refactored != Should be refactored
Read more here:
https://www.devleader.ca/2023/12/27/when-should-code-be-refactored-what-you-need-to-know/
"Always be refactoring. If you touch the code, and you can improve it, improve it, but never optimise early."
https://levelup.gitconnected.com/martin-fowler-was-right-microservices-suck-573bbf09a0fd
We organise in the open, and you're very welcome to chat with the organisers to help, ask questions, give feedback, or simply to watch. You can reach us on the #ev_socratesuk slack channel (https://slack.softwarecrafters.org/), or on mastodon, LinkedIn, BlueSky, or by emailing organisers at socratesuk dot org.
We organise in the open, and you're very welcome to chat with the organisers to help, ask questions, give feedback, or simply to watch. You can reach us on the #ev_socratesuk slack channel (https://slack.softwarecrafters.org/), or on mastodon, LinkedIn, BlueSky, or by emailing organisers at socratesuk dot org.
Leanpub Book LAUNCH 🚀 The Other Half of Coding: What they Didn't Teach You by Max Guernsey, III
This is our second launch video for this now-completed book!
Watch here:
#books #leanpublishing #selfpublishing #booklaunch #programming #TDD #BDD #coding #softwareengineering #refactoring
Leanpub book LAUNCH 🚀 The Other Half of Coding: What they Didn't Teach You by Max Guernsey, III
Watch here: https://youtu.be/lDwuiSwaCf4
#books #leanpublishing #selfpublishing #booklaunch #management #coding #programming #OOP #TDD #softwareengineering #refactoring
Habr » 🤖 🌐
@habr@zhub.link
Три агента, один репозиторий, ноль менеджеров. Как я построил конвейер, где ИИ пишет, ревьюит и деплоит код
Месяц назад я закинул задачу на рефакторинг модуля авторизации и пошёл варить кофе. Кофе я допить не успел. Через двадцать минут пришло уведомление в ТГ: «staging обновлён, 94 теста пройдено, 0 упало». Открыл репозиторий. Ветка, diff на два экрана. Code review от второго агента. Три замечания, два по делу. Третий агент прогнал тесты и задеплоил. Код был чище, чем я обычно пишу по пятницам. Но до этого момента были три месяца граблей, упавший продакшен, и одна ночь, когда агенты сделали десятки бесполезных коммитов. Обо всём по порядку.
https://habr.com/ru/articles/995430/
#LLM #AI_agents #python #code_review #автоматизация #docker #redis #claude #refactoring #AI
Refactoring can work wonders for simplifying code
Read more here:
https://www.devleader.ca/2023/12/04/how-to-simplify-your-code-with-effective-code-refactoring/
How do you know when to rewrite it all instead of refactor?
Read more here:
https://www.devleader.ca/2023/11/26/rewriting-vs-refactoring-code-how-to-navigate-the-two/