I got an idea about a code view as a comment lines. Just sharing, might hope someone to grab and build his next AI startup:
📝 Idea: Make a Recipe from the code comments. Code recipes is a view mode… | Medet Atabayev
Idea: Make a Recipe from the code comments.
Code recipes is a view mode in your editor to read it.
In code recipe mode, instead seeing a programming language grammar words, we see the comment line for each programming language command. For example, can you understand what does following piece of code do?
But, in code editor mode, I would read the code piece as the bullet points: - Convert source code into ontological json data. Ontological json data is called 'contents'. // ...this.identifyContent(... - content is created, lets create its restful api // ...PageLevel.rest... - Re-identify page-rest if extensions ask for. // ...extension.afterPageRestCreation(.. - to make CSS Selector 'module > .page-content', so lets find module in reflect object tree // ...rest.get(..moduleURL...)... - make the branch as a sub-branch of the reflect. // pageRest.setRootNode(moduleNode) - keep alive the page rest object, so that reflect rest could refer to it. // _pageRests[moduleURL] = pageRest
In above list, instead the code, we see the comment lines. And instead comments we see highlighted pieces in the code line. The comment with the highlighted code pieces should be in grey, although I didn't know how to change font colour in LinkedIn. And that code is interactive, clicking on the highlighted codes will expand it or redirect the user to the whole line.
This mode is now possible with the LLMs. I as a developer write the comments on the complex parts, or in necessary parts. Often intentionally not putting comments on the code lines that I think are self explanatory, there comments are actually distracting and irritating. But now, LLMs could do really well about describing the command lines. You could highlight for the AI the parts, that are the main focus of the code piece. And for the readers as well. :)
I also think, maybe add some emojis or smileys next to the recipe code views, so its easier and enjoyable to do the most hated thing: to read someone else's code.
The code recipe isn't good when debugging code errors, when you need to optimize or write the code piece itself. But if you want to understand the code at the architectural, business flow level through the code, for refactoring or for modification, then code recipe is another nice-to-use way. :) I would be glad to see it.
This is cool. I used to be a diehard Refactoring/Martin Fowler fan, but then a friend pointed out that what qualifies as "well-written code" depends on the audience/situation. They broke it down into a few situations:
- Debugging - Temp variables and print statements are good here. Sometimes, long functions without too many subroutines can be easier to reason about.
- Refactoring - Temp variables are bad since they created dependencies throughout code. Long functions generally bad. DRY.
- Writing code - You're pushing paint around on the canvas and you probably should be copy/pasting and duplicating things while you figure out what's going to work.
- Reading code - Comments, clear variable names, etc.
- Production runtime - Performance > readability
It will be cool if AI will adapt the code to whatever context we're in