r/AskProgrammers • • 1d ago

Do you actually write pseudocode on paper before coding an assignment, or do you jump straight into the IDE?

Every CS professor preaches "plan your logic on paper frist," yet 90% of us open vs code immediately and sent typing until something compiles.

Be honest: when an assignment gets complex, does sketching ir out in your notebook actually save you time?

9 Upvotes

76 comments sorted by

18

u/gwenbeth 1d ago

Write your pseudo code out as comments in your editor. Then go and add in the code and leave the comments in place

3

u/iLaysChipz 1d ago

Yep. I just write a bunch of TODOs and then gradually fill them in once my architecture is mapped out

3

u/Tony1Rice 1d ago

This is a great way to do it BUT, as you make those little on-the-fly corrections to your logic, make sure the comments reflect what you actually coded. There's nothing more annoying to a third party, or to next week's version of yourself, than nice clear comments that explain something other than what the code is actually doing. And let the comments explain -what- the code is doing, not -how-. The code itself explains the "how".

2

u/Strong_General6771 1d ago

Those comments stick around. Only reason the logic still makes sense months later

1

u/nacnud_uk 1d ago

Interesting. I've worked in code bases where comments were not allowed. So the code had to really be self documenting. With modern editors like VSCode etc, it's all kind of "just there". And AI is making "write a report on the structure of this code base" almost a trivial non-task now.

Interesting the different approaches.

2

u/Tony1Rice 1d ago

Self-documenting code should always be a goal that you strive for but it's often a lot easier said than done. One of the tenets of FORTH programming, is to name your defined "words" such that the code reads easily. It's easier in some languages than others.

2

u/Strong_General6771 1d ago

Self documenting and AI reports cover the structure. Neither explains why that ugly branch had to exist

1

u/RealisticDuck1957 1d ago

Well written code documents what is being done at the implementation level. Comments are often still needed to record why it is being done.

Also, the long identifier names demanded by "self documenting" style quickly get very annoying. So we use shorter, but still meaningful, identifiers. And add comments to more fully document what the associated entity is.

1

u/gwenbeth 1d ago

Code doesn't always make stuff obvious. A real world example is I had an html table and I didn't want a build name with a hyphen to word wrap. So I had a regexp that changed the hyphen to a non breaking hyphen. That line of code got a comment because there was no way to tell what was going on from looking at. The other thing that code does tell is why you did something. On some credit card processing code we had to make a change that violated the spec because there were credit card terminals that sent bad packets that must have worked with some other processor. We added a comment explaining why that line was there so that in the future if someone looks at it and thought about taking it out because the spec said it shouldn't happen that they would know it was there for a deliberate reason.

1

u/ReddyKiloWit 1d ago

My technique, essentially -- but about equal English (the why) and pseudo code (the how).

10

u/MauriceM7 1d ago

In professional environments paper has been replaced by whiteboards.

10

u/Status_Fun_4333 1d ago

Coming up on 30 years doing this professionally. I don't write crap in pseudo code. By the time I'm ready to sit down and pound out the code I already have a rough idea of what it will look like in my head. And even that will morph over the time it takes to pound out.

System design? Like how things are gonna talk to each other? DB schema? What services do what and how they all interrelate? Hell yeah, sketch that on the white board or put it into some other kind of durable reference.

5

u/symbiatch 1d ago

I don’t have sketchbooks. Never had those. I sketch in my brain and that’s it. I never just “write until something compiles.” It’s of course already planned and decided how it goes.

I don’t do assignments, just work, but it’s the same thing.

1

u/konacurrents 1d ago

I too think and dream in coding an interesting problem I’m designing.

I was wondering are the AI users dreaming in prompts? How sad.

5

u/boring_pants 1d ago

I think your professor might be trying to help you learn.

They are not saying "Professionals always write out pseudocode on paper before they start coding and this is what you should also always do"

They are saying "you won't fucking learn to program if you just open VS code and hammer away until something compiles*.

They are trying to get you to stop and think about the problem in front of you, breaking it down and working out how to solve it. Because that is a useful learning exercise.

It's like when you're learning to write your teacher might ask you to keep writing the letter 'a'. That's not because you'll ever need to be able to write a pageful of 'a's in real life. It is because once you have done that you will find it easier to write single instances of the letter 'a' in the future.

They are trying to teach you to plan out your code. The paper is just a learning aid.

But to answer your question, yes, absolutely. When faced with a complex problem I sketch out solutions and take notes. I don't do it for simpler tasks, in part because exercises such as this helped teach me to better think about problems and break them down and express them in logic.

2

u/Sea-Disk5517 1d ago

I was told to think of it like a recipe. I still do it a lot because it helps with documentation. I also leave comments that correlate to different blocks . For me it's faster to look things up that way. But Im not a senior by any means and can't just shit out full programs yet.

1

u/Dramatic-Hold-9369 1d ago

this is the answer

2

u/DanielTrebuchet 1d ago

I definitely did that more early on. 20+ years in now and I rarely need to pull out pen and paper. I tend to go more with a layout of pseudocode that I can then go right back and expand on.

But the concept is sound. There have been lots of times over the years I've started to get deep into logic and started to get twisted around a bit, and sitting down and writing the flow helped me process what I needed to write in code.

2

u/Tony1Rice 1d ago

When I took a FORTRAN class at university, the prof insisted that we write out our programs' logic in pseudocode. My pseudo code looked amazingly like BASIC, which I had learned the semester before, so fleshing it out to actual FORTRAN code was just a matter of fixing the syntax (and getting it onto punched cards!

The same class required flow charts, too. While it was a PITA to go through those extra steps at the time, it did develop the idea of thinking about a program before starting to write it. I often don't do that planning stage so rigorously in real life and that usually works out OK because I developed the habit of planning that way even if I don't actually write it down... But I have occasionally wished that I had done so.

2

u/ByronScottJones 17h ago

Back in the olden times, when I actually wrote code, I would start out by writing comments explaining in plain English what I wanted to do with the function. I would iron out all the details in plain English. Only once I fully understood the purpose of the function would I then add the actual code, replacing comments in some places, but leaving important comments in place. I found that works very well. Today, with AI tooling, one of my directives to the agents is that all functions must have plain English comments describing the code, and that every code update must also update the comments.

As for the "no comments" crowd - I disagree, and won't debate it with you.

1

u/Specialist-Cup-3950 1d ago

You can plan the logic in many ways. Pen and paper, TODO.md, code comments, tldraw... It depends on what I need to do. It doesn't save time, but it helps maintain quality

1

u/dariusbiggs 1d ago

paper designs and notes, sometimes yes

using a scratchpad in the IDE and write psuedocode for the task, also sometimes yes

using the IDE to code it straight away, if it is trivial yes

1

u/overratedcupcake 1d ago

If it's part of the assignment then yes. Otherwise no. Though I have done many many whiteboard sessions in my career. Not pseudocode on the whiteboard but definitely mapping out structure/relationships/architecture. 

1

u/CyberDingo_66 1d ago

Plan out however works for you. I prefer using a pen and paper or whiteboard because it's quick and easy to sketch/draft out something before coding. I would make an effort to get into the habit of planning out before coding. It will save you time and effort of refactoring large sections of code.

1

u/whitetiger1208 1d ago

In 10 years as a self taught swe i havent done that once.

1

u/DanielTrebuchet 1d ago

I question the complexity of the projects you work on. My current project has over 60 database tables, all highly relational and interconnected. I can keep a lot of stuff straight in my head, but that starts pushing it.

1

u/dld2517 1d ago

Yes. It does. I also use VSCode for that. The complete planning document is a markdown file(s) in the project folder. That makes it easy to copy portions of that planning file into other source code documents and create comment headers.

1

u/SayuriShoji 1d ago

When coding I have Notepad++ open in the background, which I use to scribble out pseudo code and pseudo structures to brainstorm ideas.

It's especially useful when I have an idea for a future feature and just want to save a rough overview of the concept and structure so I can look it up later.

1

u/No_Report_4781 1d ago

yes, or pseudo in notepad, or pseudo in the ide. writing out the blueprint or plan simplifies the decisions on what needs to be done and when, shortening the amount of time and decision making when putting syntax to line

1

u/Leverkaas2516 1d ago edited 1d ago

I sometimes sketch the flow and/or the modules or data using diagrams on paper. But for pseudocode, handwriting is slow. I type the pseudocode into a source module in the IDE, then convert that to code. The pseudocode is often the basis for some of the comments.

I don't "type until something compiles". I fill out the skeleton of the module, perhaps stubbing some things out, and use the compiler to catch typos.

1

u/mkhanwrites_ 1d ago edited 1d ago

It doesn't matter where you write your preliminary sketch/ideas, it's helpful no matter what for complex topics.

The topics you're engaging with are most likely of the simple variety but eventually you'll get to the point where you need to think about system design.

Even at the level you're at, planning could be beneficial.

1

u/CheezitsLight 1d ago

I used to decades ago. I sometimes would print out on paper and study it. Usually made a lot of marks on it. But I come from an era of paper tape and assembly where I write hand assembly, and coded in octal and hex looking at programming cards and hand assembling. Made a pretty nice chessboard in 2k, tied a 14 digit calculator to the 7 segment display and keyboard on a 1k F8 yo make an algebraic programmable calculator. It was a pain in the ass to program because every time you turn the power on you have to type in a whole bunch of extra code to get the calculator to run cuz there was no storage back then it was a few years before even a cassette tape came out.

1

u/chocolateAbuser 1d ago

it's a bit more complex than that, the point is investigate code base and do a recognition of what informations you need, both technical and human, what is impacted, and so on, think about all the relationships between entities and services, the more you can think it out and understand before effectively writing an implementation the more the implementation will fit and have less issues

1

u/AlternativeCapybara9 1d ago

Some scribbling sometimes, easier to build a minimum viable product and iterate from there. Recently with AI you can basically one shot a poc and let it code while you think of where to go next.

1

u/MagicalPizza21 1d ago

Usually typing an outline in plain English (or whatever your preferred spoken language is) is enough. But sometimes when it's more complicated, it helps to draw diagrams, which I generally prefer to do with a pencil and paper.

1

u/daiaomori 1d ago

I haven’t used an IDE for a few months now, Claude… but let’s talk about ancient times:

For complex architectures, in real life we prepared proper diagrams, especially for API boundaries and to figure out interactions. For a complex database an ERD doesn’t hurt later on, especially when the team is supposed to grow.

Scribbles might happen on paper, but even fifteen years ago everything final was digital.

Assignments in university didn’t reach a complexity for me that made any of that necessary, except for a few logic puzzles. Sometimes visualizing complex structures/algorithms helps, eg in graph theory, and paper can be helpful for that.

But that’s not specific to programming, but to thinking.

That being said, for my philosophy PhD I write on paper 70% of the time.

1

u/IlgantElal 1d ago

I throw together a napkin plan, yeah

1

u/Sea-Bench-7487 1d ago

Ide in the big 26?

1

u/Eight111 1d ago

wouldn't call it pseudocode but i def brainstorm with my agent or coworkers if im about to create some complicated design

1

u/KC_Zazalios 1d ago

Not pseudo-code but planning on paper yes

It is mandatory once you get to more complex structures

1

u/Available_Safe1818 1d ago

You can be an adult and try it yourself to see if it helps.

1

u/p3zzl3 1d ago

<html>

<font size=2>I dont know what you mean?</font>

</html>

1

u/DragonsIsleSoftware 1d ago

If I'm away from the computer I'll write some pseudo code down for ideas that pop up. I'm more likely to put it in my phone, but will fall back to paper if that is what I have. If I'm at the computer, then I see no reason to use paper to write things down that I then need to transfer to the computer. I'll type my pseudo code into the editor. I often have a dedicated notes file, or several, for any given project. I'll put my thoughts down in them, and then sort them. Once I have the general file structure planned for something, I'll often start to create the files for it and put the notes for that part in those files. Then they are nicely grouped and I can turn the pseudo code into real code all in one place. We also use a project manager to make up a to do list for things not being done right away.

Note: I haven't been a student for a long time, so this is how I work on my projects and not a school assignment, but is how I've done things for a long time. It works for me. The most important thing is to acknowledge that different people work best in different ways. Just because something is the best way to do a thing for one person does not mean it will work at all for another. Experiment and find what works for you, and use that. But also be willing to try new things from time to time and see if there are ways to improve.

1

u/Designer_Storm8869 1d ago

I sometimes ask llm to draw a diagram based on my description. Used to do it on paper before llm got popular. But I never wrote pseudocode. For tech people, it's pointless. For business people, flowcharts work better.

1

u/lmarcantonio 1d ago

"Complex assignment" is an oximoron. Most problems at school are little more than jokes.

For bigger things it's useful to make a block diagram of sort but never had to actually write specs. Except when you are doing state machines, never ever try to make one without at least a huge comment block with the behaviour.

1

u/Vizeroth1 1d ago

In the late 90s I used paper for this a lot. Now, I keep a small notepad on my desk and it is mostly covered in short reminders. For planning my code I use my code editor.

This isn’t “typing until something compiles”, I’m taking notes of the structures I need to interface, what needs to be done, etc. It isn’t even pseudocode for the most part, it’s text that I’ll eventually use as comments for the code I actually write afterwards.

Sometimes I go through multiple rounds of this because I get to a point where I realize I’ve over complicated something or I didn’t anticipate something else. It’s often a mix of gathering requirements and designing abstractions/hierarchy.

Part of this comes from a 5-year period when I transitioned from writing desktop applications as a mostly solo developer to a web/mobile developer on a team. I had a very good manager who wrote excellent requirements documents, so now that I’ve moved on to a lead role with less helpful management, I’ve been trying to produce that level of documentation for myself and my team.

1

u/Pitiful_Welcome7125 1d ago

I used flowcharts. I can visualize better seeing how a system flows. I also would write out story lines; 'this thing needs to happen, this is the journey to get there'. I'd also use quick prototyping to build a framework, see how that worked, and make changes along the way (I was lucky to have an environment where spinning up prototypes was stupid fast/easy allowing me to try/discard/try again without a lot of pain or time investment).

I also did a lot of 'talk to the duck' during both design and debugging. It's a great tool.

1

u/ZakMan1421 1d ago

I've never really written pseudo code outside of proofs. I will, however, use flow charts to get the general idea of the program.

1

u/nacnud_uk 1d ago

Just type. If you have to type English first, fair enough. Just type though. Sure, sketch some diagrams if it helps. Whatever gets you through. But, type. that's the main thing.

Find your way of working. In 2026, I'd work with AI to flesh it out, if you're struggling.

1

u/xenaretos 1d ago

Planning in general - maybe, but it usually it fits in my head.

Pseudocode on paper soounds like something from 1976.

1

u/atticus2132000 1d ago

There is always some sort of planning step. Depending upon how difficult the task is, it might be a full blown outline on paper or just some notes that I type into the IDE as a simple structure for the code to follow.

The level of the detail in your outline will be dictated by how much detail you need for development. If you're the type of person who benefits from a line-by-line pseudocode, then make it that.

One HUGE benefit is an outline is, if you do it right, then it serves as your code documentation later on. Essentially you're writing your documentation before or while you're actually coding it rather than forcing yourself to come back later and document your code (which we never actually get around to).

1

u/spinwizard69 1d ago

It would depend upon the assignment. For example at work I'd be writing test scripts and knew exactly what i needed to code up, no need to spend extra time beyond pounding out code. On the flips side, programming old servo motor controllers required having the manual right beside the editor and creating an opcode list in a spreadsheet. That spreadsheet listed the opcodes function and was laid out with a sketch (flow chart like) of what i was trying to achieve.

It is important to understand that "plan your logic on paper frist," doesn't always mean pseudo code. Your use the tools that make the most sense for whatever you are programming.

1

u/DragonfruitGrand5683 1d ago edited 1d ago

I use natural language to plan.

I only use pseudocode if I am stuck on the logic for something and I need to step through it on paper.

Complex programs require formal documents. The more complex your program is the more planning and testing required.

1

u/Any-Interview-1276 1d ago

For a school project you can skip it, but in a real job with a software that’s more than a couple files, you need a technical spec (not on paper, but basically the same thing).

1

u/burlingk 1d ago

Yes.

I write pseudocode on paper before coding actual projects.

I also sometimes do it in notepad. Or like u/gwenbeth says, in your editor as comments to code to.

1

u/Daydreamer-64 1d ago

Planning logic on paper and writing pseudocode on paper aren’t the same thing. I’ll usually do initial data flow diagrams on paper or a whiteboard, then do some more in depth architectural diagrams also on paper or a whiteboard.

Usually I will then write those up properly using diagramming software, but I often don’t bother and just work off a photo of the hand drawn diagram.

Then I’ll write the code.

The problem is that your professor needs to instil that mindset in you, but you don’t make complex enough projects to require architectural diagrams and discussions.

1

u/Immediate_Form7831 1d ago

This has never sounded like very good advice to me. I need to get the feeling of a problem by doing some exploratory programming first. Planning is all good, but no need to limit it to paper.

1

u/NoTime4YourBullshit 1d ago

I’ve never written a plan down on paper except for my CS professor in college.

I do stub functions a lot though and then use comments to remind myself what I’m thinking here.

1

u/bcgonewild 1d ago

I do this less once I started using TDD. The tests guide implementation, so you don't have as many assumptions about how it's going to work when you start. Your first test should be a simple "for this input, expect that output." Given that test you'll have ideas about how to fetch or construct the output and you do the simplest thing that makes the test pass.

Having a pseudo code outline is good for learning though. One way to write a good test is to ask "if my code was wrong how would I know it?" and write a test that exercises that case. The pseudo code can help you think about ways things could go wrong: what if the input is missing or malformed? What if a call to an external service is slow or fails? Feel free to deviate from the sketch once your tests start challenging you to do something different. Tests can encourage good practices like dependency injection and encapsulation which you may not think of when sketching the pseudo code.

1

u/lisnter 1d ago

For anything non-trivial you need a set of requirements so you know what you’re building before you do anything. Then some sort of architecture and enough design so you have a structure into which/onto which you build the functionality.

Yes. I’m old but do this and you’ll be successful. Ignore it at your peril.

1

u/Yepes_J 1d ago

Sorry for mi English, when I have a task I read it and in draw io I do a first diagram and I read it after I do correction with AI when I have goal well in this moment I start to programming

1

u/ReddyKiloWit 1d ago

I generally start with some data design drawings and high-level flow charts on paper, just to fix the mental images in place. Then off to the editor where I start writing comments and bits of pseudo code. Actual code comes later, when I've blocked out enough to start testing a particular subset of the project.

1

u/yrrot 1d ago

There are times. The main thing about writing it out is that it is basically the "rubber ducky" trick for finding logic errors. Explaining what your code does [to a rubber ducky], or writing it down, forces your brain to process the logic in a way that it gets stuck when you hit an obvious logic error.

Just depends on what you are building and how clear it is what needs done. Bigger projects are probably going to have more planning (and more people). Sometimes your planning ends up evolving into something you can share with the team to keep everyone on the same page.

Even if you are going to hop directly into coding, sometimes it's useful to do things like writing your unit tests in parallel so you are forced to use the code you are writing immediately. You end up doing chunks of planning as you write because you have to figure out how that code is going to be used while you write the test.

TL;DR: it's not going to hurt to have it <shrug>

1

u/laconix31337 1d ago

paper? its fine if you are nowhere near a pc i guess.  else vscode, notepad++, anything but paper.

1

u/Mediocre-Pumpkin6522 1d ago

Sometime about midway through the last century I used coding forms. Never since.

1

u/iWhacko 22h ago

a lot when i first came from uni. but mostly do it in my head now. Only some complex stuff i still sketch down into little diagrams.
But I agree with the teacher, its good to do it untill its second nature. It helps you visualise the code. and drawing those PSD makes you think ahead of certain "blocks" which will teach you to think of the bigger picture in the long run.
Been a software engineer now for 25 years.

1

u/olive_oil_lover_ 20h ago edited 20h ago

In the professional world, we do more than just put things on paper when designing a domain in DDD as well. https://res.cloudinary.com/andreavallotti/image/upload/blog/images/ddd-workshop/006-big-picture-eventstorming.jpg

1

u/rakotomandimby 17h ago

I first write a long comment describing what I will write in this file. It can be pseudo code. Then, I let Copilot suggest.

1

u/_BeeSnack_ 14h ago

feed the spec to the agent

1

u/Utchas 14h ago

Depends.

Something sophisticated and has external dependencies, planning specially diagraming helps to find different approaches, blockes, workarounds, trade-offs even before pseudo code.

Something non trivial and you have a clear workflow in your mind, pseudo code helps to break things into smaller pieces and keep things organized.

Something trivial like CRUD operation or similar simple stuff doesn't require any prior planning, pseudo code

1

u/shan23 8h ago

You can also just think first without using anything.

Has worked well for me

1

u/newyorkerTechie 4h ago

I did in college. It’s a great way to learn. I’d even write out implementations with pen and paper.

These days, I usually whiteboard when trying to explain something to someone.

1

u/a1ien51 2h ago

They are trying to get you to think it out before you just start coding.

In the real world you are making flow diagrams of complex problems and you run it against other people.

1

u/DeterminedQuokka 2h ago

So I’m a professional not in school but if I’m solving something challenging or in a coding interview I write pseudocode in a comment first. Or even just the steps in comments.

If it’s a multi step solve i draw diagrams for everything and will usually put code snippets in them.