Most powerful?
Lately, for no obvious reason, my email has been getting daily 'picks' from Quora.com, a sort of Pinterest for programmers. Occasionally the question and answers are worth a few minutes of reading.
Today's pick was a question about the most powerful line of code. Consensus answer was the loop, as in
do { something } while x
Why powerful? Because it gives you the ability to repeat. Saves the most boring part of your work.
Okay, but simple repetition is not unique to computers. Planets and engines repeat their sequential actions forever. Nor is the for-loop unique. All sorts of simple mechanisms run for-loops in various degrees of nesting. A clock or a cash register or an odometer. An alarm clock is a for-loop with a breakpoint set by a real-time variable input. Fairly sophisticated. Early computers couldn't do it, and even some modern languages like Tkinter can't do it. You can halt the program from the keyboard, but you can't input new info while the program is running.
If you're looking for a powerful piece of code, you want an action UNIQUE to software.
I'd vote for the associative array because it's NOT repetitive and NOT binary. You can form a real-world decision process, matching appropriate responses to a wide variety of input situations. No automatic machine has ever implemented an associative array. Many passive devices are associative, such as a phone directory or a file cabinet.... but those devices don't run on their own; they require human action to see the association and dial the number or pull the folder.
A jukebox is less passive but still misses the point. It associates a label on a button with an appropriate record, but it doesn't automatically play
"Heaven's just a sin away" when it senses that someone in the bar is fighting temptation, or
"He stopped loving her today" when it senses that someone has been betrayed. It waits for humans to make those choices.
= = = = =
Relevant: What if a jukebox had two levels of association, like a two-manual harpsichord? On the lower level K37 would play
Heaven's Just by the Kendalls. The same button on the higher level would play
Wir Eilen by Bach. Same rhythm, similar harmony, more sophisticated music, LESS sophisticated lyrics. Button A37 on lower level would play
Satisfied Mind. Same button on upper level =
Ich esse mit freuden. B21 on lower level is
this old music hall number. B21 on upper level is
Heute Noch, the most perfect and heavenly melody ever written, with the most prosaic and stupid words ever written. (I wonder if Bach was taking a dare or winning a bet...)
= = = = =
Later addition: In 1965 Seeburg actually had a dual-mode jukebox, but it wasn't pop vs classical:
Labels: TMI