Click here to Skip to main content
15,888,816 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
Member 1181677618-May-20 3:47
Member 1181677618-May-20 3:47 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
sasadler18-May-20 8:51
sasadler18-May-20 8:51 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
nedzadarek18-May-20 10:25
nedzadarek18-May-20 10:25 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
B Alex Robinson18-May-20 13:45
B Alex Robinson18-May-20 13:45 
GeneralRe: What's the Most Concise, Human-Understandable Practical Language? Pin
Vikram A Punathambekar26-Jun-20 2:57
Vikram A Punathambekar26-Jun-20 2:57 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
Kirk 1038982118-May-20 14:56
Kirk 1038982118-May-20 14:56 
GeneralRe: What's the Most Concise, Human-Understandable Practical Language? Pin
nedzadarek19-May-20 3:55
nedzadarek19-May-20 3:55 
GeneralRe: What's the Most Concise, Human-Understandable Practical Language? Pin
kalberts19-May-20 6:15
kalberts19-May-20 6:15 
I think of it more at a concept level rather than saving typing. Avoid reduncancy. Avoid tokens that serve no purpose. Remove clutter.

As I argued earlier in the thread: A language such as CHILL allows any block to have an exception handler attached. Putting "try{...}" around the block before the handler is redundant: If the handler is present, then the block has a handler - no need to pre-announce it! Removing the need for that pre-announcement simplifies the code.

(The real reason for the C/C++ try{} is purely historic: C didn't have any such thing, while several other languages did. So to "compete", a macro-based solution was devised, that required no extension to the underlaying compiler. When adopted into the C/C++ language, it could have been given a cleaner syntax, but to be backwards compatible with all the code that had been written for the macro-based implementation, the syntax was kept unchanged.)

In Pascal (or CHILL), you write a condtion without enclosing parethes like in prose text: If it is raining, then you better wear a raincoat. You need not clutter up that sentence with parentheses markup. You remove the conceptually informationless tokens.
var matching = new List<FileInfo>();
rather than
List<FileInfo> matching = new List<FileInfo>();
removes redundancy, risk of inconsistency, and the reader has fewer tokens to interpret. I do not see what we gain by repeating the type information when it can be infered. (var has other uses as well unrelated to this.)

A language recognizing a statement as a block avoids redundant bracketing: At the spur of the moment, I cannot think of a single case where single-statement block and a single statement are both valid but with different semantics. So I see no reason why some languages insist on adding these extra tokens that carry no semantic information.

The idea is that non-information-carrying elements (that you nevertheless have to relate to) are bad. The fewer elements you need to process mentally, the better.

This is, of course, assuming that the programmer/reader easily relates to the concepts repersented by the tokens. E.g. to a matehmatician, matrix inversion is such a basic and common concept that giving it a separate symbol (analogous to multiply and divide) as it done in APL (created as a mathematical notation, not as a programming languge) is perfectly fine even though non-mathmaticians says "Huh?". For those who are "only engineers", powers are essential, so languages with that user group in mind have a token for that operation (like 2**11 or 2^11); that simplifies and improves readability of engineering calculations, rather than "power(1, 11)". A low-level language for handling bit patterns does the same with left and right shift operators: There is no need for a symbolic function name, and parentheses around an argument, when you can simply write it as a double larger- or smaller-than sign. That removes clutter.

This kind of simplification, avoiding information-less elements, results in a consisness that eases reading and comprehension of the program.

And also: What is essential information should be clearly visible. Whitespace[^] was certainly created as a joke, but we may wonder if that was as a reply to languages that demark e.g. what is to be repeated, a loop body, by ... whitespace. OK, the number of (visible) tokens is reduced, but when the consiseness is based on invisible whitespace tokens that has essential semantic importance, then the language designers have gone too far in "consiseness"!
GeneralRe: What's the Most Concise, Human-Understandable Practical Language? Pin
johnywhy23-Oct-21 3:45
johnywhy23-Oct-21 3:45 
GeneralRe: What's the Most Concise, Human-Understandable Practical Language? Pin
johnywhy23-Oct-21 3:50
johnywhy23-Oct-21 3:50 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
GuyThiebaut19-May-20 0:36
professionalGuyThiebaut19-May-20 0:36 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
James Curran17-Jun-20 20:40
James Curran17-Jun-20 20:40 
GeneralRe: What's the Most Concise, Human-Understandable Practical Language? Pin
johnywhy23-Oct-21 3:39
johnywhy23-Oct-21 3:39 
AnswerRe: What's the Most Concise, Human-Understandable Practical Language? Pin
johnywhy22-Oct-21 8:07
johnywhy22-Oct-21 8:07 
Generalhtml button not firing on mobile, oh Pin
raddevus11-May-20 9:16
mvaraddevus11-May-20 9:16 
GeneralRe: html button not firing on mobile, oh Pin
Richard Deeming11-May-20 9:31
mveRichard Deeming11-May-20 9:31 
GeneralRe: html button not firing on mobile, oh Pin
raddevus11-May-20 9:39
mvaraddevus11-May-20 9:39 
GeneralRe: html button not firing on mobile, oh Pin
raddevus11-May-20 10:54
mvaraddevus11-May-20 10:54 
GeneralRe: html button not firing on mobile, oh Pin
Marc Clifton11-May-20 9:32
mvaMarc Clifton11-May-20 9:32 
GeneralRe: html button not firing on mobile, oh Pin
raddevus11-May-20 9:41
mvaraddevus11-May-20 9:41 
GeneralGenerated over 5.5 Billion random numbers, but no 0. Pin
raddevus19-Apr-20 7:15
mvaraddevus19-Apr-20 7:15 
GeneralRe: Generated over 5.5 Billion random numbers, but no 0. *UPDATED* Pin
Peter_in_278019-Apr-20 12:13
professionalPeter_in_278019-Apr-20 12:13 
GeneralRe: Generated over 5.5 Billion random numbers, but no 0. Pin
Rick York19-Apr-20 12:14
mveRick York19-Apr-20 12:14 
GeneralRe: Generated over 5.5 Billion random numbers, but no 0. Pin
raddevus19-Apr-20 15:47
mvaraddevus19-Apr-20 15:47 
GeneralRe: Generated over 5.5 Billion random numbers, but no 0. Pin
Nelviticus26-Apr-20 23:12
Nelviticus26-Apr-20 23:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.