|
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?
|
|
|
|
|
The Grand Negus wrote: It's curious that you should pick the ramp function as an example
It was random pick
The Grand Negus wrote: What's the formula for a rose, or an ocean? for love or hate or courage or cowardice?
What's your point, do you often use "love" or "courage" in your programs?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
The Grand Negus wrote: It's a curious phenomenon.
Yes it is. Despite everything you are still using this as a forum to pimp PE.
This statement was never false.
|
|
|
|
|
Strictly speaking, C doesn't either; the "C preproccessor" does, and I can use the "C preprocessor" with C#, or VB, or T-SQL, or any other text file.
But, yes, in C# I would use const or maybe even an enum .
|
|
|
|
|
PIEBALDconsult wrote: On a side note; the guru insisted we use define s rather than const s to conserve memory.
Many times the optimizer will not actually reserve memory for const s unless you do something like take the address of it. But, if you do use the const s, you get the added benefit of compiler-checked type safety.
--
Marcus Kwok
|
|
|
|
|
PIEBALDconsult wrote: On a side note; the guru insisted we use defines rather than consts to conserve memory
Holy s**t!
Are you working in a ultra restricted realtime environment with only 16 bytes of RAM or what?
Otherwise, of course you already know it, but someone ought to explain the new and shine idea (only 20 years old!) of type safety to the guru.
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
Math might change in the future and you want to have dynamic code!
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|