I have a discussion question about pseudocode this week in my computer science class. I thought I'd open it up to this community since many people on this site have varying degrees of experience in the arena of software and content development. So, in my class we are exploring what are the different examples or methods of writing pseudocode, what are the different rule sets, why it is useful and how it can be applied when making an algorithm.
I promise you aren't doing my homework, you would be helping me to better understand the subject and enlightening me in a way that will make me a better developer in the end. Plus, my homework this week is writing two Java programs, so I'm kinda on my own with that anyway.
What are your experiences with pseudocode and how have you applied/written/transitioned it into an algorithm or code for a program? Thanks a lot and excited and eager to read responses!
ALL YOUR BASE
ARE BELONG TO US
Hey! I work as a professional software engineer. Since I work primarily in Java, I don't write too much pseudocode. For me, the method name IS the abstraction. If I know there's some logic I need to write but I want to get the overarching steps down first, I'll go ahead and put it into the code as a method and implement it later. Everyone works differently, though.
°º¤ø,¸¸, B I R D Y,¸¸,ø¤°º
Now that I'm certain that we’re not doing your homework…
When it comes to writing noncomplex programs, I often use pseudocode to make sure that my reasoning and logic is valid. This often includes drawings or sketches that can help visualize how the data will be manipulated or how data structures interact with each other. This helps me visualize the workflow and make sure that everything’s running smoothly. For these, I often use a Swift-like or Python-like syntax, which is pretty lax and is a neat way of outlining the steps you want your program to take. I don't pay too much attention to the rules I use on this methodology. Most of the time, though, I write most pseudo codes using a mix of languages that help outline what I want. From that, I then work into polishing into the program by writing it out neatly in the IDE.
For more serious or complex methods, I like to start with some sort of pseudo-pseudocode, in which I outline the main steps of the method or workflow in plain English. From there, I evaluate whether I could extract some portion of the algorithm into a separate function. Then, I’d divide the large pseudo-pseudocode in smaller sections, which I would then work in a way that’s pretty similar to the workflow outlined in my first paragraph.
Overall, I find it quite useful to make sure that your logic is sound and that the final product will behave appropriately, given the fact that you implemented everything correctly. Another bonus I often find from this is that it gives me the opportunity to evaluate whether some piece of code needs to be refactored or extracted as a new function and make sure that I’m not overloading functions with excessive amounts of code.
Not only do I use pseudocode before implementing functions, but I occasionally find myself working through pseudocode based on other people’s works that I wish to understand or revise. One thing I learned from my programming professor is to read out code as ”paragraphs, ” which might seem weird to explain in this short message but has definitely helped out throughout the years. It’s where you analyze one or two lines of code and, in your own words, describe what’s happening. You could call it sort of inverse pseudocode, where you use it to translate code that’s been written already into something that’s human-friendly.
Of course, as everything in life, pseudocode can have its shortcomings. There have been a few scenarios in which pseudocode hasn’t been so helpful. For example: trees. I’ll just never understand them at all.
Thanks much for posting on a topic like this one. Looking forward to more replies!
Edit: I would’ve been more specific, abundant, and provide some examples, but writing this from my phone greatly discourages me from doing so. Might do so in the near future, if I remember it.
There is no place