• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Pseudo code generator

 
Ranch Hand
Posts: 52
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there such a thing?

googled but couldnt find anything
 
Saloon Keeper
Posts: 11902
253
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
warren brandt
Ranch Hand
Posts: 52
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 11902
253
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
warren brandt
Ranch Hand
Posts: 52
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fair enough thanks for that Stephen!!!
 
Saloon Keeper
Posts: 21981
150
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic