Posts

Improving the prompt to the AI to get better code

In a previous article I looked at one-shoting a solution to optimise code to show the variation in different AI. Thsi is the not the best way to get what you want however. More often you need to either refine the prompt or give feedback. After one-shoting the same prompt on multiple AI, I have created a refined prompt based on the various concerns with previous results. The prompt Based on the results in a previous run Asking multiple AI to optimise the same code Suggest how to implement this more optimally using low latency techniques to minimize any objects created. ## Use - a ThreadLocal for temporary data. - simple maths rather than a library, add comments for clarity if needed. - offset in the form ±hh, ±hhmm, or ±hhmmss, using the shortest form that does not lose information, where hh, mm, and ss are the hours, minutes, and seconds east (+) or west (-) of UT - return a `intern()` String. ## Don't use - String.format - String operations that create objects. - any co...

Asking multiple AI to optimise the same code

As different AIs are implemented differently, they don't all provide the same answer, nor do they consistently outperform one another. The best approach is to use multiple AI and pick the one you like best. My goal here is not to declare a winner based on one example, but instead to show the variety of answers you can get with different AI. I asked each AI to Suggest how to implement this more optimally private static String formatOffset(int millis) { String sign = millis < 0 ? "-" : "+"; int saveSecs = Math.abs(millis) / 1000; int hours = saveSecs / 3600; int mins = ((saveSecs / 60) % 60); int secs = (saveSecs % 60); if (secs == 0) { if (mins == 0) { return sign + twoDigitString(hours); } return sign + twoDigitString(hours) + twoDigitString(mins); } return sign + twoDigitString(hours) + twoDigitString(mins) + twoDigitString(secs); } private static String twoDigitString(int value) { ...

Practical Considerations for Advancing AI Collaboration in Software Development

TL;DR Human-in-the-loop is essential; AI offers probability, not certainty. AI excels at word-smithing , so spend more time on documentation and context. Leverage diverse AI models for varied research, improvements, and analysis. Be wary of deskilling : if AI makes a task trivial, agents may soon replace it. You should feel like you are testing the boundaries of what AI is capable of for at least some tasks. The Problem AI’s proficiency in handling routine coding allows human engineers to dedicate more time to strategic activities such as system design, architectural planning, intricate requirement elicitation, and the rigorous evaluation of application performance across multifaceted metrics. Tools often amplify underlying behaviours and failures — Rob Lambert Value is increasingly found not in rote knowledge, which AI can often provide, but in the capacity to frame complex problems effectively for AI, critically evaluate its probab...

A Functional intreface can extend other interfaces

Image
A functional interface can extend a marker interface, functional interface, non-functional interface, and an annotation. A recent X poll suggested 25% of those responding didn't know that.

Hands-On Career: The Evolution of a Java Champion

Image
Table of Contents Introduction Superhuman Intelligence Is Already Here ATMs Didn’t Replace Bank Tellers About Me Multidimensional Growth Areas of Career Development Scope of Consideration Roles Where All Areas Are Important The Range of a Founder’s Role How Will AI Change Development? How You Ask the Question Changes the Result Some key terms in understanding how Generative AI works Estimating the Value of AI-Generated Documentation AI and the Reverse Baltimore Phenomenon The Baltimore Phenomenon The Reverse Baltimore Phenomenon Filling a void Brainstorming Ideas Sample Project 2048 Using Prompts as Meta-Programming When AI is useful What Generative AI Can’t Yet Do Human in the Loop Conclusion This article is background material for this talk Lessons learnt from founding my own company, and over 30 years hands-on coding Introduction Unlike most deterministic development tools, Generative AI is a productivity...

Does AI-Generated Documentation Have Value?

As many have observed, at best, AI generates either: Mundane, repetitive documentation or code that most experts already know or If an expert doesn’t know it, they can ask an AI to explain it anyway. Is it the case that if an AI can generate it, it’s not worth adding to your documentation or code? While this is usually the case, there is still value in reading AI-generated documentation as a means of reviewing and validating what you might write differently. In this post, I show how changing the documentation can affect the AI’s output and how reviewing it can be a useful exercise. Estimating the value of AI-generated documentation I tried to gauge the relative value of AI-generated documentation for my knowledge and set expectations for others. I asked o1 pro to generate user guides in several different ways I considered effective for: a simple class and package a large class and package a complex class and package Then, ...