Generate pseudo-code from what? The point of pseudo-code is that it's written by a person to describe an algorithm in broad strokes so it's easily understandable to another human being. How is a computer going to do that without advanced artificial intelligence?
posted 2 months ago
Yes i know pseudocode should be written first but lately when i write pseudocode i never think of every eventuality and my code changes compared to the pseudocode,now i have to write the
pseudocode out from scratch again,its a tedious long winded process...but yes...i know what you going to say next, dont cheat!
Stephan van Hulst
posted 2 months ago
Pseudo-code doesn't have to take every edge case into account. That's why it's pseudo-code. The intention is to convey the basic idea behind an algorithm.
Even if there was an application that would generate the pseudo-code for you, it would probably be of such poor quality that it's even harder to understand than the actual final code.
If pseudo-code were good enough, it would be real code!
What I did, and what Donald Knuth did was write the pseudo-code in the comments that head up my functions. Knuth named this approach "literate programming", and incidentally, we developed this concept completely independently. I also did something that resembled Agile before Agile was cool, but that's another story.
What I did was write up the "what" of the function in comments. I'd also add special considerations as updates to those comments as they occurred to me. The comments didn't say how it was to be done - that was for the code itself when/as it was written, but it was a reminder of what the purpose of the code was, lest I get so immersed in implementation that I lost function.
My original inspiration to formally organize along those lines was the AutoDoc function used by Commodore on their Amiga Personal Computer documentation and used to generate their "man" pages. They were developing on Unix machines, and the Amiga was sufficiently advanced that eventually it became capable as a development machine in its own right, and a lot of the Unix-like functionality ended up on the Amiga as well. I'm not sure that the AutoDoc processor ever was made available to the general public, but the fact that there even was such a thing was an inspiration.
Eventually, I ended up doing C++ on Windows and I developed an AWK script that could read my comments and produce Windows Help files as documentation. Then Java came along and the JavaDoc processor was part of the standard developer kit. While it's not quite the same as what I'd been using, it's close enough. And it's expandable if I ever felt the need for something more. You can also make JavaDocs very pretty by using HTML tags in the comments. That's good for tables and bullet lists.
Getting back to Knuth, his Literate Programming initiative was based on a program named "web" (no relation at the time to the nascent Internet) and worked with the TeX document formatting system so beloved of academics. I don't believe it ever saw use in a commercial development environment, but it was important enough to him that he more or less neglected his work towards expanding the Art of Computer Programming to develop it.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
Oh the stink of it! Smell my tiny ad!
global solutions you can do in your home or backyard