News for hackers. Stuff that matters.
Re:Programmimg Pearls (1985) by macintux on Thursday November 24, 2022 @06:00PM (#33737181)
I thought the title here had a typo, but no, indeed, the typo is at the ACM website (but not the paper itself).

Some choice tidbits in there.

> The job’s not over until the paperwork’s done.

Re:Programmimg Pearls (1985) by tkhattra on Thursday November 24, 2022 @06:11PM (#33737266)
bentley revised and updated some of his "programming pearls" columns and published them in 2 editions of books published circa 1986 and 2000. they are among my favorite computer science books, and a great companion to more theoretical data structures, algorithms, and software engineering texts. a great mix of theory, engineering, rules of thumb, insight, creativity etc., all presented lucidly. highly recommended!
Re:Programmimg Pearls (1985) by vram22 on Thursday November 24, 2022 @06:59PM (#33737544)
Yes, those two books are Programming Pearls and More Programming Pearls. I have both, and they are good. In one of them there is a section or chapter with a few examples of advanced uses of awk, involving awk's associative arrays, to do some non-trivial work in very few lines of code[1]. He shows or says that the equivalent programs in C would be much longer and harder to write.

[1] Even more so than in most other common examples where awk programs are shorter than those in other languages.

Re:Programmimg Pearls (1985) by fernly on Thursday November 24, 2022 @07:05PM (#33737576)
What a user-hostile web page that is. With the "eyelid" banner that keeps trying to close, and the tiny blurred type, and no visible way to continue to the next page, and the usable text linked by buttons above the text, buttons that are quickly hidden from view by the "eyelid" if you scroll far enough to start reading the blurred text... a disaster. ACM should be ashamed.
Re:Programmimg Pearls (1985) by IlliOnato on Thursday November 24, 2022 @07:19PM (#33737659)
I thought there was only one page... how one gets to the next one?
Re:Programmimg Pearls (1985) by fernly on Thursday November 24, 2022 @07:53PM (#33737859)
Get the PDF or etext -- from the buttons that are hard to find.
Re:Programmimg Pearls (1985) by shever73 on Friday November 25, 2022 @03:36AM (#33740445)
Re:Programmimg Pearls (1985) by satyanash on Thursday November 24, 2022 @07:39PM (#33737770)
> Allocate four digits for the year part of the date: a new millenium is coming -- David Martin, Norristown Pennsylvania

2038 is 15 years away right now; this article was published 15 years before 2000.

Re:Programmimg Pearls (1985) by bombcar on Thursday November 24, 2022 @07:55PM (#33737887)
Even in 1985 you could foresee wanting to reference something after 2000 - terms for a thirty year loan, for example.

Harder to see reasons past 2038 back in 1970.

Re:Programmimg Pearls (1985) by nerdponx on Thursday November 24, 2022 @10:05PM (#33738743)
> Harder to see reasons past 2038 back in 1970

I still find myself confused at this one. Did people in 1970s not imagine that any particular program or database would "survive" for 30+ years? Was the expectation that programs written in the future could set the epoch to a later date?

Now that I think about it, I also find it interesting that the epoch date isn't configurable in any system that I'm aware of.

Re:Programmimg Pearls (1985) by p_l on Thursday November 24, 2022 @10:37PM (#33738914)
Nobody expected Unix timestamp to survive so long when it was designed, and norm was to use different format in databases that would care about dates beyond 2038
Re:Programmimg Pearls (1985) by bombcar on Thursday November 24, 2022 @11:39PM (#33739234)
And memory was very precious. Why waste bits that would always be zero?
Re:Programmimg Pearls (1985) by p_l on Friday November 25, 2022 @03:07AM (#33740295)
Not just bits - unix timestamp ossified as 32bit value on PDP-11, and handling longer timestamp would involve a lot more code to implement arithmetic on larger than 32bit values, plus also would complicate C language
Re:Programmimg Pearls (1985) by varjag on Friday November 25, 2022 @03:21AM (#33740370)
It's a worthy exercise to code for a while on a vintage machine with a hundred or so kilowords memory. Puts things into perspective.
Re:Programmimg Pearls (1985) by Gordonjcp on Friday November 25, 2022 @05:30AM (#33741047)
Unix timestamps can represent dates *before* 1970, by using negative numbers.

Dennis Ritchie has said that he picked signed 32-bit values with an epoch of 1/1/1970 because that would comfortably represent dates exceeding his life - before he was born until after his (expected) death.

Re:Programmimg Pearls (1985) by guenthert on Friday November 25, 2022 @02:15PM (#33745804)
All computer evolution up to that day happened in the 30 years prior, so how on earth could they possibly expect that their system would last such a long time?

I do recall from the time frame mid-eighthies to mid-nineties that three year old computers were obsolete. Ten year old stuff was ancient history. Never would I have imagined to be able to use Linux for 30 years.

Re:Programmimg Pearls (1985) by Throwawayaerlei on Friday November 25, 2022 @02:58PM (#33746166)
IBM's promises, largely delivered to this day, that their System/360 computer hardware and future generations would be compatible, as was that line of computers except for the lowest end special case? All the effort IBM put into emulation of their older machines in the microcoded models (all but two high end ones)?

Some time before then it was realized we had a "software crisis" as outsiders put it, and IBM realized they were spending too much money supporting many different designs, some evolutionary with minor changes?

Many ideas behind systems like Linux go back to the 1960s as well, see Multics, the primary inspiration for UNIX but ultimately a closed source dead end.

For the original question we have to realize how very small many old computers were. UNIX started on small DEC minicomputers, it would have made almost no sense at all back then to allocate more than 32 bits when your maximum data address space was 56KiB and your CPU was 16 bit (the PDP-11 family where UNIX became big following an incompatible DEC predecessor).

Re:Programmimg Pearls (1985) by throwawaytemp29 on Friday November 25, 2022 @02:10AM (#33740010)
Y10K bug! Only 4 digit dates.
Re:Programmimg Pearls (1985) by watersb on Thursday November 24, 2022 @07:41PM (#33737783)
It's still a great book. Based on a regular feature in the "Journal of the ACM" I believe, Programming Pearls presents simple exercises and walks through some ways to approach the solutions.

This is from very early days as computers were becoming more common, so an example problem might be "Count the number of occurrences of each thing from a text file and print sorted results."

Something you could do in a single command line these days.

But! Rather than present data structures and algorithms, although those are in there.

It's the way to ask questions to lead to a solution.

Anyone who has written an entire AI-based inference engine, when the customer wanted a spreadsheet, will get a kick out of this.

And those of us who haven't (yet) will gain some insight that might prove useful later on.

Re:Programmimg Pearls (1985) by biryani_chicken on Thursday November 24, 2022 @08:46PM (#33738240)
It's also in archive.org [0] with better quality and several formats for download.

[0] https://archive.org/details/ProgrammingPearls2ndEditionJonBe...

Re:Programmimg Pearls (1985) by tkhattra on Friday November 25, 2022 @12:24AM (#33739512)
i don't think that's the text of the entire book - it looks like a scrape of the book's former website (www.programmingpearls.com).
Re:Programmimg Pearls (1985) by gregfjohnson on Thursday November 24, 2022 @09:50PM (#33738664)
If this is the first time you’ve heard of Jon Bentley’s “Bumper sticker computer science”, you are in for a rare treat! It is a combination of the hilarious and the deeply insightful. An absolute joy, and a must-read for computer scientists and programmers. It is a distillation of aphorisms and wisdom from an entire generation of many of the world’s best minds in our discipline.
Re:Programmimg Pearls (1985) by embit on Thursday November 24, 2022 @09:58PM (#33738709)
John B. on quick sort. Just awesome explanation

https://m.youtube.com/watch?v=QvgYAQzg1z8

Re:Programmimg Pearls (1985) by bhrgunatha on Friday November 25, 2022 @02:50AM (#33740214)
The analysis of comparisons was both brilliant and illuminating.
Re:Programmimg Pearls (1985) by eimrine on Thursday November 24, 2022 @11:32PM (#33739184)
Why to avoid asymmetry?
Re:Programmimg Pearls (1985) by edent on Friday November 25, 2022 @12:47AM (#33739637)
I was wondering about that. I think it is about having the ability to go A->B without being able to go B->A.

But, as with many of the Pearls, it is heavily context dependent. And if you aren't well versed in "primitive" computing paradigms, you'll be confused.

Re:Programmimg Pearls (1985) by epgui on Friday November 25, 2022 @02:51AM (#33740220)
It's a bit hard to explain this one, but symmetry is a form of simplicity. This might make more sense to a physicist or mathematician.
Re:Programmimg Pearls (1985) by ezekiel68 on Friday November 25, 2022 @04:11AM (#33740627)
This is only an opinion --but it's the opinion of someone who has been involved in software engineering since the 1990s:

Since this quote is in the section of general advice, I feel this advice applies mainly to the analysis and design of systems. Here's an example: You want to make a command line program (or it could be an API) that can behave differently, depending on certain conditions. So you have an analysis and design problem, which is: how do you cover these different scenarios (flexibility) without making the program/api too difficult to use (complexity)?

If you hard-code the choices into the system, it gets a part of the job done, but there is no flexibility and so your system will be useless to those who need the outcome to match certain common use cases. But, on the other hand, if you require users to type in a long list of parameters every time they use the system (complexity), users will avoid this solution because it is simply too difficult to use for the most common scenarios.

Symmetry in this sense means striking the right balance among the aspects of usefulness and simplicity so that your system will match the needs of its intended users. In my hypothetical case, the programmer might provide a config file which lists comments showing the default values for the config options. If a user needs to tweak this behavior slightly from the defaults, they can set the config values as it suits them in the config file once, rather than needing to remember to type the overrides in as command-line params each time.

Again -- this is one simple example. When defining a data model (a different realm where symmetry applies), it is common to take many iterations to "get it right" so that the system can properly reflect a real-world problem, such as how to represent that 'many students take many classes at the college'. Early efforts tend to be "asymmetric" in the sense that they fail to capture key relationships between important concepts by making the data model too "flat" or simplistic. Further modeling efforts, though, may make the opposite mistake by trying too hard to faithfully capture every possible corner case, including those which either seldom occur or have no practical value (such as recording whether any instructors took leaves of abscence during a semester, when the point of the system is to capture student attendance and grades).

Re:Programmimg Pearls (1985) by toolslive on Friday November 25, 2022 @06:25AM (#33741376)
"asymmetry" typically involves exceptional state/behaviour. It's an extra cost while you're building it, and it's an extra cost while maintaining it. For example, a customer wants something special but it will only be needed by that customer.
Re:Programmimg Pearls (1985) by NorSoulx on Friday November 25, 2022 @03:03PM (#33746218)
I co-designed and developed one of the early SMS content platforms in Norway back in 2000. I had bought and read Programming Pearls, and used ideas from this book to implement number portability routing/handling when it was introduced for mobile operator phone numbers in Norway.