r/cprogramming • • 13d ago

Does flowchart and pseudo code are necessary to learn to for c?

/r/c_language/comments/1xyc7fn/does_flowchart_and_pseudo_code_are_necessary_to/

I am so confused

0 Upvotes

12 comments sorted by

4

u/marc_b_reynolds 13d ago

No. Both are intended to describe a routine without a specific language. Flowcharts are mostly dead: a precursor to pseudo-code in pre structured programming language days.

2

u/the_imposter_2 13d ago

Then why they still teach us?

3

u/marc_b_reynolds 13d ago

I'm not sure who "they" are or what they're supposed to be teaching and to what kind of students...so can't comment. I suppose using some flowcharts could be OK for people that have zero programming experience....but I think something like "scratch" would work better for more people.

2

u/Paul_Pedant 13d ago edited 13d ago

Go out and buy some self-assembly furniture. It comes with a sheet of instructions that shows you all the parts, where all the screws go, and the order that you should do bits of it.

The instructions do not actually become part of the furniture. You can throw them away when you have built the desk, table or whatever. Best not to throw them away too early, though.

The data flows and pseudo code exist to organise your ideas. They also are very helpful when you break up the workload across several people in a team. Nobody writes 1000 lines of code in a disorganised lump, because it simply does not work, either when you write it, need to debug it, or have to add some more features.

Flowcharts are junk because they are equivalent to spaghetti code: you can just draw in arbitrary connections that make no sense. As far back as the 1980s, my company was using a set of rules called Dimensional Flowcharts, which were essentially a tree-structured organisation of the logical design. Those rules were exactly what you needed to make it almost impossible to write bad code.

Also, the same rules work for any language, not just C. They work for building a garden shed, or planning a holiday or a wedding.

1

u/tastygames_official 12d ago

I think for absolute beginners, flow charts can be a nice way to teach programming. First you learn the logic (conditionals, loops, jumps, functions) conceptually and then later you learn a language. And maybe you might lean a pseudo-language before, since then it can help you translate to every other language, as each language has their small differences, but pseudo-code is generic and can then be applied to any language.

3

u/Specific-Housing905 13d ago

Maybe not really necessary but helpful. Both help you to structure your thinking process and think more like a programmer. Learning C or any other language on its own won't help you. A language is a tool to solve problems. You need problem solving skills as well.
There are too many people here on Reddit who have learned a language either by course, book or YT but can't build even a single app.

2

u/the_imposter_2 13d ago

I agree with the thing you said , but my doubt is why in the c there is no flowchart and pseudo code are not appearing once you done with them?

2

u/alkavan 13d ago

No. Just learn C, don't make it complicated — it's not.

2

u/70Shadow07 13d ago

Absolutely not, but pseudocode is handy sometimes (people mostly use python as pseudocode nowadays, its actually pretty decent for this purpose). Flowcharts are meh, most people seem to like pseudocode more, unless ur dealing with complex algorithms and processes.

Some domain specific graphs such as railroad diagrams for parsing are awesome though. Just stay the fuck away from UML.

1

u/zeekar 13d ago edited 13d ago

Pseudocode is useful because it gets you thinking about the general mechanism of programming. – turning problem-solving logic into code – without getting hung up on the specific syntax details of a real programming language like C. In C, forgetting a semicolon can cause the whole program to break, but that's just noise in pseudocode. Get the ideas right, the control flow; capture the chunks of code that repeat with the explicit conditions that control exactly when they repeat - that's the stuff that you need to get right no matter what language you wind up writing the program in. Removing the need to "sweat the semis" (as my old CS prof said) frees you to think about the logic at that higher level so you can get it right. Once it's clear and you understand what you're doing, then you can sit down to translate it into nit-picky programming language syntax.

Flowcharts are not as useful in the modern era. They were helpful, back when people were drawing them by hand because actual computer time was too expensive to waste on anything but the final version of the code. When all the planning and development was handwritten on paper, drawing boxes and arrows was no harder than writing text, and helped clarify things. Besides, the languages they were using generally required you to code control structures manually with goto, so those arrows were exposing connections that weren't visibly obvious they way they are in a structured programming language. But flowcharts generally take a lot more space to convey the same ideas, are not as easy to change with digital tools, and permit unstructured constructs that we now know better than to use.