Live data from Hacker News

What can be learned from studying long gone development practices?

shape-of-code.coding-guidelines.com

31–40 of 142 posts

Re: What can be learned from studying long gone development practices?

#31
I am a big fan of Jackson Structured Programming (the other JSP), from the 70s, and have used it many times. When it is the right a match for a given problem, the design and implementation will work first time, every time.

And that problem is where the input can be modelled as a stream of structured events.

This may sound too abstract, but it includes, for instance, pretty much any file. But the value lies more in that it makes it trivial to design a file format that is easy to parse, and process.

For me the value lies in that in the old days techniques were developed to systematically solve programming problems that will always we relevant, in this case processing a stream of events.

It is very well explained in the follwing MIT ocw lecture (it uses Java, but is actually language agnostic):

"Designing stream processors

Stream processing programs; grammars vs. machines; JSP method of program derivation; regular grammars and expressions"

https://ocw.mit.edu/courses/electrical-engineering-and-compu...

To practice it, you could try "Project 1: Multipart data transfer" in the link below:

https://ocw.mit.edu/courses/electrical-engineering-and-compu...

Re: What can be learned from studying long gone development practices?

#32

`Structured programming' is actually used to refer to two different things: reducing or eliminating the number of gotos, and top-down programming. The former is universally understood to be generally a good thing (though there are still some good uses for gotos); the latter was the fad. The 1970s was the time of HIPO (hierarchy/input/process/output) charts. An early-1980s research project I was acquainted with at the…

Top-down/procedural fits really nicely with the unix command line philosophy. Loose coupling and pipes. You can understand why it was the de facto One True Way before GUIs.

Re: What can be learned from studying long gone development practices?

#33

I'm not sure you can call structured programming a fad! An awful lot of languages (I'd say all commonly used ones) use if/then/else, do..while, for..next, and so on, but I can't remember the last time I saw a program with a complicated control flow done by gotos. Such things were common in the 1970s, in fact the first professional program I ever read did it that way, and it took me ages to work out what was going on.…

Well puppet doesn't have loops. I hope that's not because the "fad" is ending.

Re: What can be learned from studying long gone development practices?

#34
post #33

I'm not sure you can call structured programming a fad! An awful lot of languages (I'd say all commonly used ones) use if/then/else, do..while, for..next, and so on, but I can't remember the last time I saw a program with a complicated control flow done by gotos. Such things were common in the 1970s, in fact the first professional program I ever read did it that way, and it took me ages to work out what was going on.…

Well puppet doesn't have loops. I hope that's not because the "fad" is ending.

There are plenty of further restrictions (such as immutable languages that don't have loops, because loops require mutation, and so instead rely on recursion), or which eschew being concerned about control flow at all (such as puppet, SQL, Prolog, etc; any declarative language). Certainly, those languages aren't "undoing" structured programming.

Re: What can be learned from studying long gone development practices?

#35

I'm not sure you can call structured programming a fad! An awful lot of languages (I'd say all commonly used ones) use if/then/else, do..while, for..next, and so on, but I can't remember the last time I saw a program with a complicated control flow done by gotos. Such things were common in the 1970s, in fact the first professional program I ever read did it that way, and it took me ages to work out what was going on.…

"... I can't remember the last time I saw a program with a complicated control flow done by gotos."

Perhaps not "complicated" enough, but here's a fizzbuzz in spitbol (a fast SNOBOL interpreter). This is an unstructured, goto based language for non-numeric computation developed at Bell Labs. Would love to see a faster version in some popular, "structured" scripting language in the same number of characters. I find I can write scripts in more aesthetically pleasing ways than with "structured" languages. But of course aesthetics is subjective. (The term "subjective" here means what looks good to you might not look good to me, and vice versa.)

   ;var a = 0
   ;start a = a + 1
   ;break lt(a,101) :f(end)
   ;x01  y = remdr(a,3)
   ;x02  z = remdr(a,5)
   ;x03  x = y + z 
   ;x01a eq(x,0) :s(x06)
   ;x02a eq(y,0) :s(x04)
   ;x03a eq(z,0) :s(x05)f(x07)
   ;x04  output = 'fizz' :(start)
   ;x05  output = 'buzz' :(start)
   ;x06  output = 'fizzbuzz' :(start)
   ;x07  output = a :(start)
   ;end
Perhaps the unintended benefit of gotos is that it becomes foolish to try to construct overly complex control flow. Whereas stuctured programmming seems to encourage control flow complexity. The use of the phrase "complicated control flow" in the parent comment is a great example. It suggests for the author structured programming allows and arguably therefore encourages such complexity. But what benefit is served by creating "complicated control flow". Why not aim for simpler control flow.

Re: What can be learned from studying long gone development practices?

#36
post #13

The article says: > Today, structured programming appears remarkably simplistic, great for writing tiny programs (it has an academic pedigree), but not for anything larger than a thousand lines. Curious. I rather think that structured programming became so ultra-pervasive in any high level programming language younger than 50 years old or so[1], that we've lost the extra name for it. Practically every programming lan…

TeX was Knuth's first “real” programming in a few years. His comments on structured programming are a bit eyebrow raising. He had high praise for it and said that it allowed him to write the whole program without having to test small parts of the program (the book with the exact quote is upstairs and I'm too lazy to go get it).

That said, I'm pretty sure that TeX is more than a 1000 lines of code.

Re: What can be learned from studying long gone development practices?

#37

I'm not sure you can call structured programming a fad! An awful lot of languages (I'd say all commonly used ones) use if/then/else, do..while, for..next, and so on, but I can't remember the last time I saw a program with a complicated control flow done by gotos. Such things were common in the 1970s, in fact the first professional program I ever read did it that way, and it took me ages to work out what was going on.…

"... I can't remember the last time I saw a program with a complicated control flow done by gotos." Perhaps not "complicated" enough, but here's a fizzbuzz in spitbol (a fast SNOBOL interpreter). This is an unstructured, goto based language for non-numeric computation developed at Bell Labs. Would love to see a faster version in some popular, "structured" scripting language in the same number of characters. I find I…

This is the opposite of aesthetically pleasing to my eye.

Re: What can be learned from studying long gone development practices?

#38

Earlier quoted context omitted.

> I can't remember the last time I saw a program with a complicated control flow done by gotos. I've run across this in C demo code for a chip designed within the last 10 years. It was all goto soup in a god function.

Some embedded developers just never got the memo about control flow constructs. You can find some truly bizarre and concerning development practices in the embedded world.

The reverse is true -- app developers see something "weird" in embedded code and think it must be wrong, but often there is a reason. E.g. the unintended vehicle acceleration scandals, where codebases were criticized for having large numbers of global variables... but it's because there's no allocation permitted, and message passing is more expensive than just setting a bit of memory in a massive cooperative multitasking loop.

You might see weird stuff in embedded code because it needs to interact with flakey hardware using a flakey compiler, and be cycle accurate in the process.

Re: What can be learned from studying long gone development practices?

#39
post #13

The article says: > Today, structured programming appears remarkably simplistic, great for writing tiny programs (it has an academic pedigree), but not for anything larger than a thousand lines. Curious. I rather think that structured programming became so ultra-pervasive in any high level programming language younger than 50 years old or so[1], that we've lost the extra name for it. Practically every programming lan…

"structured programming" is not the use of flow-control but a way to design programs.

Even if most language have structured flow-control, a lot of people NOT do structured programming.

This is how I remember it back in the day and how I do it (curiously, much better on Rust, where it match better how was done on Pascal! ie: Not OOP, big on structs, functions, enums) and is a mix of:

- Define the major components of the app and put it on "modules" (aka their own file or folder if truly large)

- Define the major structures according to the domain (aka: make tables in sql). This is what POCOs are used today or plain Rust structs.

- Make procedures that operate on the above with a clear in/out discipline. Also, document that (this one, I always forget!)

So, is not that far away from functional, inmutable programming, only that:

- A lot was mutable and pass references. This is also a big part of how you discipline to define the flow make this tractable or not

- You don't have generics or classes, so you stick to plain data, plain vectors or lists and duplicate stuff (algos) here and there (no way to abstract "map/filter/folds" that I remember)

- You must be disciplined with the naming of "modules", "POCOs" and functions. Also limited in the length of names (like files only being 8 chars), causing the rise of Hungarian notation (that was misunderstood/misused badly!)

- All your pipeline are eager (not chance of iterators and stuff) so you repeat "loops" everywhere

- Everything was more self-contained, that is great... as long you don't forget the discipline.

"The discipline" was the key here, for make this actually "structured programming".

The MAJOR point is how you STRUCTURED the program, not the use of structured control flow!

Re: What can be learned from studying long gone development practices?

#40

I'm not sure you can call structured programming a fad! An awful lot of languages (I'd say all commonly used ones) use if/then/else, do..while, for..next, and so on, but I can't remember the last time I saw a program with a complicated control flow done by gotos. Such things were common in the 1970s, in fact the first professional program I ever read did it that way, and it took me ages to work out what was going on.…

"... I can't remember the last time I saw a program with a complicated control flow done by gotos." Perhaps not "complicated" enough, but here's a fizzbuzz in spitbol (a fast SNOBOL interpreter). This is an unstructured, goto based language for non-numeric computation developed at Bell Labs. Would love to see a faster version in some popular, "structured" scripting language in the same number of characters. I find I…

Aesthetically, it bothers me that you compute x by calling remdr two extra times, as opposed to computing it as the sum of y and z... or the bitwise OR of y and z...

What's the difference between :(label) / :s(label) / :f(label) / :s(label1)f(label2) ?

Post reply on HN