| New Reply |
Jumping straight into C++ without programming knowledge |
Share Thread | Thread Tools |
| Dec13-12, 07:46 PM | #18 |
|
|
Jumping straight into C++ without programming knowledgeCode:
int main()
{
CSomething foo;
foo.dostuff();
return 0;
}
And of course you can pass in parameters to the constructor. Code:
int main()
{
CSomething foo(1,2,3,4);
foo.dostuff();
return 0;
}
|
| Dec13-12, 09:06 PM | #19 |
|
Recognitions:
|
The real issue here is not the langauge (C++) but instead the class itself and the progression from the simplest of programs to more complex ones as students progress through the class, and how well the instructor and the textbooks explain what is going on (how these programs work).
One issue is some students will want to know how a computer actually works internally, rather than just accept how everything works from a language (like C++) perspective. Those students may later decide to learn the basics of assembly programming, but I don't think this requires taking a full semester class on assembly programming unless there's really an interest in this (and if the school even offers such a class). |
| Dec14-12, 06:28 AM | #20 |
|
Mentor
|
Strictly speaking, there is no stack or heap in C++, or in C for that matter. The stack and heap are how many, but not all, operating systems model memory. C and C++ have three types of storage:
The RAII concept addresses all resources, not just allocated memory. A class that allocates resources for an instance of that class should ensure that those resources are properly "put away" when that class instance goes out of scope. This places a heavier development burden on the author of a class but significant reduces the burden on a user of that class. RAII goes a long ways to solving the memory leak problem, along with a host of other resource-related problems as well. |
| Dec14-12, 08:36 AM | #21 |
|
|
You're right of course D_H, my flub on heap/stack. I was trying to not get too deep into just what RAII means in order to answer the question.
|
| Dec14-12, 08:49 AM | #22 |
|
Recognitions:
|
I'm wondering if we're getting off topic from the original post which was asking if an introduction to programming class using C++ is a good idea. I think once the student gets into this class, either these aspects of programming will be explained, or the OP can ask questions here. |
| Dec14-12, 11:02 AM | #23 |
|
Mentor
|
There is zero need for alloca in C++. Use std::auto_ptr (C++03), boost::scoped_ptr (Boost), or std::unique_ptr (C++11) instead. |
| Dec14-12, 11:17 AM | #24 |
|
|
For my part, I did not mean to start a 'holy war'. I use a lot of languages for different purposes, there aren't many I don't like or can't find a good use for from time to time. I just intended that you can (and people often do) write useful C++ code without ever touching an implicit pointer. I don't think that pointers are "bad" by any stretch of the imagination or even that you shouldn't use them in C++ when they are the best option, just that you don't ever really *need* to.
|
| Dec14-12, 11:55 AM | #25 |
Recognitions:
|
To get back to the OP's question, the key thing is the structure of the course, not the language it uses.
What you should be learning on a first course IMO is programming. To do any practical work, you have to use some computer language, but it doesn't really matter what language it is. On the other hand, a lot of books, courses, and web tutorials don't teach programming, they teach a programming language. That's fine if you already know how to program and just need to learn another language, but it's a bad way to start. |
| Dec14-12, 04:45 PM | #26 |
|
|
Learning C++ is not that bad IMO.
If you understand the state and flow-control in any language (I know I harp on about these two things in many posts), then no matter if its a web-platform, a mobile platform, a normal PC platform, a micro-controller or embedded system, or anything else, then you'll pick up everything you need to know quickly. Just learn the flow-control and how the language implements that as well as how the language and the code changes the state-space, how its accessed, and issues regarding its access and you'll be good to go. |
| Dec16-12, 09:01 AM | #27 |
|
|
If you go this route, play special attention to the lessons on pointers and memory management, linked lists, structures and the like. You'll sink or swim by whether you learn these topics thoroughly. I almost want to say that a lot depends on the quality of the teacher or textbook. Expect to do a lot of work to learn these foundational topics, but if you do learn them, all other programming later should be easier.
|
| New Reply |
| Thread Tools | |
Similar Threads for: Jumping straight into C++ without programming knowledge
|
||||
| Thread | Forum | Replies | ||
| Linearity vs. "takes straight lines to straight lines" | Calculus & Beyond Homework | 1 | ||
| Recommended programming language (and texts) for middle-school beginner programming | Programming & Comp Sci | 9 | ||
| how much programming knowledge does a mathmatician need? | General Math | 24 | ||
| Good Phys. Knowledge vs. Good Math Knowledge | General Math | 2 | ||
| Transformations taking straight lines to straight lines | Differential Geometry | 5 | ||