|
The Grand Negus wrote: It always surprises me how people say they want their code to be transparent but nevertheless insist on using languages that require the most obtuse and unnatural syntax (as in "numDays = 7*2").
How is that obtuse? If you've done any basic mathematics it's very simple to understand and cannot be interpreted in the multiple ways in which English can be.
|
|
|
|
|
Ed.Poore wrote: How is that obtuse? If you've done any basic mathematics it's very simple to understand and cannot be interpreted in the multiple ways in which English can be.
It's obtuse because the expression is not natural for people outside of the programming community (which is tiny compared to the billions of others on the planet). For example, "numDays" is not a word in any dictionary I know. And "camel case" is not a normal form of capitalization. And "*" is not the usual symbol for multiplication. And "=" is not the normal way of saying "is". In other words, it's an unnatural mode of expression because it's not the way that most people would naturally express the thought.
|
|
|
|
|
Hmm, the chances of non-programmers writing programs?
|
|
|
|
|
Ed.Poore wrote: Hmm... non-programmers writing programs?
Picture, for example, a PAL 3000 installed in a home. The homeowner says, "PAL, wake me up at 6:00 on weekdays, except for the first Thursday of every month. Use classical music." And in so doing, the homeowner has written a program. Perhaps your definition of "program", both as a noun and a verb, is too narrow?
|
|
|
|
|
You wouldn't be programming the system more like setting up some rules for a program written by programmers to activate certain tasks.
|
|
|
|
|
Ed.Poore wrote: You wouldn't be programming the system more like setting up some rules for a program written by programmers to activate certain tasks.
But how can one tell the difference, when all of the programs - top to bottom - are written in the same natural language? If someone says, "PAL, turn on pin 3 of the parallel port," is he a programmer or a user?
|
|
|
|
|
The Grand Negus wrote: But how can one tell the difference, when all of the programs - top to bottom - are written in the same natural language? If someone says, "PAL, turn on pin 3 of the parallel port," is he a programmer or a user?
Let's see here. The original post was written in a c-like variant, say C, C++, Java, or C#. We're not talking about PAL and we're not talking about a natural language interface, and the phrase "The number of days in two weeks is 7 times 2 which equals 14" cannot be used in any of the potential languages implied by the first post.
So what, exactly, is your point? It seems to me that you're taking a conceptual framework (representations of abstract concepts in succinct and accurate ways) and extending it into a realm where it is wholly impractical (e.g., the programming language itself inherently limits the clear-language expressibility of certain concepts) for the mere purpose of.. what? Picking a fight? Having the last word?
For someone programming in any c-like variant, the expression "numDays = 7 * 2;" is sufficiently meaningful to be useful, because there's a good bet the maintainer has some familiarity with the language. That's usually almost always all that matters.
|
|
|
|
|
Patrick Sears wrote: So what, exactly, is your point? ... "numDays = 7 * 2;" is sufficiently meaningful to be useful...
My point is this. If "numDays = 7*2" is better than the original because it is more clear and natural, then a series of definitions including:
A week is 7 days.
A day is 24 hours.
should be considered even better for the same reasons. "Sufficiently meaningful to be useful" and "ideal" are not the same thing.
Patrick Sears wrote: "The number of days in two weeks is 7 times 2 which equals 14"
It's interesting how, when talking natural language programming, people dream up the most obnoxiously wordy expressions they can muster (as you have above). That kind of expression is wholly unnecessary and would rarely (if ever) be used in everyday conversation. Our compiler, having been given definitions like those above (in any order), will automatically handle other expressions such as "2 weeks" (including the implicitly defined plural of "week").
So back to the point. This is the 21st century. It's time we said goodbye to the primitive programming languages of the past. We have done better already, we can do better still, and we should not give up until we're speaking to our machines as if they were men.
This is the "Hall of Shame" forum. We, as programmers, should be ashamed of the state of the industry after all these years.
|
|
|
|
|
The Grand Negus wrote: Our compiler, having been given definitions like those above (in any order), will automatically handle other expressions such as "2 weeks" (including the implicitly defined plural of "week").
The point I think is that the C-variant doesn't require setting up those definitions first, so its more natural and efficient. One statement verses a list of definitions.
This statement was never false.
|
|
|
|
|
The Grand Negus wrote: My point is this. If "numDays = 7*2" is better than the original because it is more clear and natural, then a series of definitions including:
A week is 7 days.
A day is 24 hours.
should be considered even better for the same reasons. "Sufficiently meaningful to be useful" and "ideal" are not the same thing.
No, they're not better. They're wordier.
So, did you grow tired of your Ilion character?
--
For External Use Only
|
|
|
|
|
Joergen Sigvardsson wrote:
So, did you grow tired of your Ilion character?
It was him wasn't it? Amazing that he was quiet throughout that period, then starting posting more frequently when Ill Yon left.
Or, as I more suspect, it was his kid or a disciple.
This statement was never false.
|
|
|
|
|
I'm confident that it was either him or some other nut job in his sect. There are eerie similarities in their writing styles...
--
Raaaaaaaaaaaaaaaaaaaaa!
|
|
|
|
|
But now you're talking about interfacing with a programmed application. Namely our PAL.
You are scheduling a task with a programmed application. Do you think that the average person would be able to Create PAL?
This statement was never false.
|
|
|
|
|
Amen bro.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Shog9 wrote: you can use consts though
What would you say to constants like these:
One = 1
Two = 2
Three = 3
Lifted from a student assignment... probably been told repetitively to use constants.
|
|
|
|
|
dnh wrote: Amen bro.
But why stop there? See my reply to Shog here[^].
|
|
|
|
|
That happens all the time in programming courses (I know, I've taught!) As a teacher, you just wanna cry.
--
Presented in doublevision (where drunk)
|
|
|
|
|
Bottom line is, you can say "Do something fourteen times." or "For each day in two weeks do something".
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
dnh wrote: you can say "Do something fourteen times." or "For each day in two weeks do something".
Yes, you can. So?
|
|
|
|
|
So
The Grand Negus wrote: dnh wrote:
you can say "Do something fourteen times."
for(int i=0;i<14;i++){...}
The Grand Negus wrote: "For each day in two weeks do something".
<br />
const numOfDays = 2*7;<br />
for(int day = 0; day<numOfDays;i++){...}
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Sorry, but I still don't get your point. What are we talking about?
|
|
|
|
|
Why literal 14 is bad, bacause its not clear WHY it's 14. Isn't it mistake? Shouldnt it be 15? or 13? What the hell that number means. If you say that it's actually number of days in two weeks, it's better. No matter HOW you say it.
It's you who is talking about how plain english syntax is great and c-like syntax sucks, over and over like a mad man.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
dnh wrote: If you say that it's actually number of days in two weeks, it's better. No matter HOW you say it.
But HOW you say things does matter; some ways are better than others. Surely you can see that "repeat this 14 times" is easier for the average English-speaking person to grasp than "for(int i=0;i<14;i++){...}".
It's obvious that programmers here use certain principles, like clarity and naturalness of expression, to distinguish bad "C" code from good "C" code; but they frequently refuse to apply those very same principles in a larger and more general sense. It's a curious phenomenon.
|
|
|
|
|
The Grand Negus wrote: But HOW you say things does matter; some ways are better than others.
That was not subject of this debate, but you exactly nailed your problem.
The Grand Negus wrote: Surely you can see that "repeat this 14 times" is easier for the average English-speaking person to grasp than "for(int i=0;i<14;i++){...}".
Why not throw away language of math when you are at it, and come back to, hmm, what? Early greek philosophy?? Mathematicians have natural language at their disposal since ever. Yet, they keep developing and using symbolic formal language(s)... How so? Maybe some ways are better then others. Sure, average Joe doesn't understand http://mathworld.wolfram.com/RampFunction.html[^]. So what, average Joe doesn't care about Fourier transform, either.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
It's curious that you should pick the ramp function as an example, for I would argue that this particular function is much more easily (and understandably) described algorithmetically and that the language of traditional mathematics is therefore not the ideal representation for things of this sort. In fact, when described in a algorithm - or better yet in a natural language - the "average Joe" can understand the ramp function; it becomes trivial. The mathematical notation in this case obfuscates the thing.
That's why we find that the language of mathematics is capable of describing only tiny little bits of reality, while natural language has been used to describe, meaningfully, nearly everything that we (as a species) have ever encountered. What's the formula for a rose, or an ocean? for love or hate or courage or cowardice?
|
|
|
|