C/++, you're on notice!
Grievances with C;
I have to tell you NOT do do something?!? That's stupid. I'm the programmer, I tell you what to do.
"VOID" SETUP or "VOID" LOOP? I'll tell you what C, if I want you to bring me back a value, I, will tell YOU, to bring me back a value. Don't go doing stuff on your own!
INT, integer, really?!? The last time I paid attention to math class was fifth grade. Call it "name" or "address" or anything better than "InTEger". You might as well just write the language in Greek.
C/++, you're on notice!
I have to tell you NOT do do something?!? That's stupid. I'm the programmer, I tell you what to do.
"VOID" SETUP or "VOID" LOOP? I'll tell you what C, if I want you to bring me back a value, I, will tell YOU, to bring me back a value. Don't go doing stuff on your own!
INT, integer, really?!? The last time I paid attention to math class was fifth grade. Call it "name" or "address" or anything better than "InTEger". You might as well just write the language in Greek.
C/++, you're on notice!
C++ doesn't "do something on its own", the return type is required. "Void" is specific and helps avoid ambiguity.
How is "name" or "address" better than "int"? If "int" is "name" then what is "float"? What is "long"? Addresses are pointers, they are not integers.
It seems to me you have a grievance with C++'s level of control, while complaining about the lack of it.
If you have a problem with integers, go back to math class.
I have to tell you NOT do do something?!? That's stupid. I'm the programmer, I tell you what to do.
"VOID" SETUP or "VOID" LOOP? I'll tell you what C, if I want you to bring me back a value, I, will tell YOU, to bring me back a value. Don't go doing stuff on your own!
INT, integer, really?!? The last time I paid attention to math class was fifth grade. Call it "name" or "address" or anything better than "InTEger". You might as well just write the language in Greek.
C/++, you're on notice!
C++ doesn't "do something on its own", the return type is required. "Void" is specific and helps avoid ambiguity.
How is "name" or "address" better than "int"? If "int" is "name" then what is "float"? What is "long"? Addresses are pointers, they are not integers.
It seems to me you have a grievance with C++'s level of control, while complaining about the lack of it.
If you have a problem with integers, go back to math class.
You do realize this is a rather humorour attempt at saying C has some wierd names right?
I have to tell you NOT do do something?!? That's stupid. I'm the programmer, I tell you what to do.
"VOID" SETUP or "VOID" LOOP? I'll tell you what C, if I want you to bring me back a value, I, will tell YOU, to bring me back a value. Don't go doing stuff on your own!
INT, integer, really?!? The last time I paid attention to math class was fifth grade. Call it "name" or "address" or anything better than "InTEger". You might as well just write the language in Greek.
C/++, you're on notice!
C++ doesn't "do something on its own", the return type is required. "Void" is specific and helps avoid ambiguity.
How is "name" or "address" better than "int"? If "int" is "name" then what is "float"? What is "long"? Addresses are pointers, they are not integers.
It seems to me you have a grievance with C++'s level of control, while complaining about the lack of it.
If you have a problem with integers, go back to math class.
You do realize this is a rather humorour attempt at saying C has some wierd names right?
Aspie Humor! Sometimes I get lost...
I don't find C's keywords weird, I think they're brief and to the point
It's not actually C's fault.
Here's my problem, I purchased an arduino for my students, highschool, I'm a student teacher. I want to introduce the students to electronics and the programming process in the hopes that they can build things on their own, and have some ownership and pride. So the arduino uses C for the programs.
I don't really understand c that well but my students are having an even tougher time. The sad thing is, they get the board, the get the pin outs, it's that language that is tripping them up. I was told arduino is for "lay people."
Friday, I came in and I told the students to forget everything I tried to explain to them, "Integer is just a way of 'naming' a pin or a piece of information... And the Arduino's language is stupid, you have to tell it NOT to do something, that's why you write VOID in front of setup or loop, otherwise it's gonna search for some address or value". The kids got it. They started making stuff on their own or adapting projects.
I wish there was a language that was better for lay people, that was written in not percise technical terms that are accurate, but rather are in simple and conventional phrases. The phrases that C has that are more conventional such as SETUP, the kids got that. So it's not really C's, fault, it was designed for another purpose.
Don't forget the creat() system call in the list of strange names.
At least the names in C fit on a terminal line. After that six-byte external symbol restriction was lifted a while back, some of those names are so long they make your head spin. Throw in some anonymous functions, and it looks like line noise.
Then there's jQuery, where you're never quite sure if what you've got is a JavaScript property list or some CSS because they're almost identical.
Lots of weird stuff. Goes with the territory.
Here's my problem, I purchased an arduino for my students, highschool, I'm a student teacher. I want to introduce the students to electronics and the programming process in the hopes that they can build things on their own, and have some ownership and pride. So the arduino uses C for the programs.
I don't really understand c that well but my students are having an even tougher time. The sad thing is, they get the board, the get the pin outs, it's that language that is tripping them up. I was told arduino is for "lay people."
Friday, I came in and I told the students to forget everything I tried to explain to them, "Integer is just a way of 'naming' a pin or a piece of information... And the Arduino's language is stupid, you have to tell it NOT to do something, that's why you write VOID in front of setup or loop, otherwise it's gonna search for some address or value". The kids got it. They started making stuff on their own or adapting projects.
I wish there was a language that was better for lay people, that was written in not percise technical terms that are accurate, but rather are in simple and conventional phrases. The phrases that C has that are more conventional such as SETUP, the kids got that. So it's not really C's, fault, it was designed for another purpose.
Yeah you should start them on a language like Python or Ruby and move them to C eventually if ever.
Nothing against you, I'm sure you're a great teacher, but it's possible someone well versed in C could have gotten them moving more smoothly.
I'm going to check out python and ruby, but i arduino can work with python, I'll check that one out specially.
I do wish there was someone that was really familiar with C, because I'm not the best person for this. I'm pretty good with the components though. My brother is a comp programmer. I have consulted with him on this.
The class of kids are used to not understanding things and they usually just give up, all across the board, not just in homeroom. The kids basically shutdown when I tried to explain things accurately and technically. When the kids started figuring things out, I told them, "I didn't give you the answer, because I don't really have it, lol. It was you guys, you figured it out." For the purpose of giving the kids confidence in their own abilities, the fact that I don't know C works out great.
I do wonder though, if they could get much more programming ability out of this with someone else. I also wonder if my "simpler" phrases may trip them up when they know more about the program but I have to get them going off the ground. I would like to turn the students over in a few weeks to a real expert or encourage the students to continue with this online and maybe at community college.
Oodain
Veteran
Joined: 30 Jan 2011
Age: 34
Gender: Male
Posts: 5,022
Location: in my own little tamarillo jungle,
the arduino is specifically a collection of software and tools for micro c microcontrollers.
included is the wiring programming language, it is as easy as python and java, in some ways easier, it has a huge library support and you can recode specific modules in c if the need should arise.
when working with the arduino i use it even if i plan to drudge my way through most of it in c, (yes for me at my current skill level that is a time consuming task)
in that case the ide simply serves as a way to neatly arrange c program using wiring as an intermediary.
incidently i know that there are dozens of open source and easy to follow education plans for groups of people.
some made specifically for high school, you should ask on the arduino forums, there is a fairly good community there.
if nothing else it will give you an ide aof what pace others find suitable and what methods did and sometimes didnt work.
_________________
//through chaos comes complexity//
the scent of the tamarillo is pungent and powerfull,
woe be to the nose who nears it.
sliqua-jcooter
Veteran
Joined: 25 Jan 2010
Age: 37
Gender: Male
Posts: 1,488
Location: Burke, Virginia, USA
C as implemented on an Arduino is extremely simple - but you're over complicating things. The pins on the arduino are numbered, thus they're represented by numbers, aka Integers. The keyword integer describes the *type* of number stored (whole numbers), as opposed to a decimal value or "float" (floating point).
As for your issue with the void keyword - it's not that the method isn't doing anything, in fact it's just the opposite. Your method either returns a value to wherever you call it elsewhere in the program, or it doesn't. Usually, the methods that are void are the methods that are actually doing something to the pins on the arduino.
The way it made sense to me is when I actually made a program that *did* return a value - which most of the time you're not doing in Arduino sketches. Consider having your students write a simple calculator sketch - have them assign pins as digital input pins and make different buttons represent different numbers - then assign 5 more buttons to functions (add, subtract, multiply, divide, equals) - then have them make methods for each function that return the result of that function, and then figure out how to display that result (depending on what you have available, you can either use 7 segment displays or the serial output to the computer). That way your students are actually defining methods that DO have a return value, and that will probably help them understand better than any explanation could.
_________________
Nothing posted here should be construed as the opinion or position of my company, or an official position of WrongPlanet in any way, unless specifically mentioned.
I have to tell you NOT do do something?!? That's stupid. I'm the programmer, I tell you what to do.
"VOID" SETUP or "VOID" LOOP? I'll tell you what C, if I want you to bring me back a value, I, will tell YOU, to bring me back a value. Don't go doing stuff on your own!
INT, integer, really?!? The last time I paid attention to math class was fifth grade. Call it "name" or "address" or anything better than "InTEger". You might as well just write the language in Greek.
C/++, you're on notice!
I'm not sure why you're complaining about these things. There are a lot of problems with C++ but the things you mention are not really an issue.
It would be possible to check for a return statement in the body of the function and detect void automatically but it wouldn't really be a good idea. This would require adding a special case which would be inconsistent with definitions of functions that do return a type (all so you didn't have to type four letters and one space). You'll find that the same situation with void occurs in other statically typed languages without type inference (e.g. Java, C#, etc.).
As for int, calling it name or address is a terrible idea since that's not what an int is. int is a good name since it says exactly what it is (an integer).
What you're suggesting is exactly what C is doing. It needs to know whether to return a value, and if so, what type. Void means that there is no return value. Saying 'void' is telling C "when you go do what I told you to do, don't give me a return value".
Integer is the mathematical name for positive and negative whole numbers. C didn't make that up, mathematicians did. If you never heard that in a math class, then your math classes were wrong.
I think you're misunderstanding what 'integer' is, here. It is what the type of the variable is. It's the kind of value the variable holds. An int holds a value like 5 or -1, but not like "Hello, my name is Inigo Montoya".
Something like 'name' or 'address' would be good as a variable name, to describe what that variable is used for (if it's being used as a name or an address). Not every integer is going to be representing a name or address, so if you used that as the type of the variable, it would be confusing in almost every case.
If you said 'name counter = 5;' then it wouldn't make sense, since names have nothing to do with counting, and 5 has nothing to do with names. Saying 'int counter = 5;' makes sense, because 5 is an integer, and when you count, you do it with integers.
_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton
You can omit the return type of a function (this causes it to default to int) but it's poor coding practice so fortunately it's almost never used.
You could do that in C (I don't know if it's still legal in C11) but not in C++. I believe that's a relic of the B language?