C++
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Calculator Programming subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. General Coding and Design => Calculator Programming
C++
Author Message
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 21 Apr 2006 05:43:07 am    Post subject:

benryves wrote:
Or maybe it's just that I come into contact on a daily basis with people learning C or C++ as their first language, and the results are never pretty Wink

Why, the Java-only pupils are so much better? Very Happy
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 21 Apr 2006 06:29:08 am    Post subject:

I think with shooting yourself in the foot (C[++]) you will be teaching yourself more, while with an environment that cares about you (JVM) you would be more in a method of being taught.

From what I've observed in others in classes, the first requires more motivation but you will learn how to do things very well and you have an almost ensured high degree of quality in your work because you won't have any trouble understanding yourself and will blow your leg if if the quality is severly lacking, while the latter allows you to learn more things in the same time but with a quality dependant on the instructions and your ability to follow them.

So you should perhaps decide based on your ability in either method of learning.
Back to top
Plague


Member


Joined: 28 Mar 2006
Posts: 242

Posted: 21 Apr 2006 10:39:32 pm    Post subject:

A book caught my eye at booksamillion today and i bought it.

"Beginning C++ Game Programming" by Michael Dawson.

From reading the first few sections, this sounds like a realy good learning tool if your wanting to make C++ programs, and this guy recommends c++ over c since it is basicly C + more. (his general idea)

The book came with a cd with DevC++ comiler (wich i already had), all teh source, and many apendex files that are rather usefull. If you wanna invest $30 in something, check out this book if you want to learn C++ basics, sounds realy good so far.
Back to top
Tiberious726


Advanced Member


Joined: 07 Oct 2005
Posts: 284

Posted: 22 Apr 2006 11:00:42 am    Post subject:

thompson press right?; i have found that in general those books are rather lame and only teach you the methode of programing but not what is actually going on and to program bigger things you really need to know what is going on

EDIT: and C++ has less than C in many, many areas; if you want something with more try Objective C


Last edited by Guest on 22 Apr 2006 11:01:38 am; edited 1 time in total
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 24 Apr 2006 10:03:00 am    Post subject:

CoBB wrote:
benryves wrote:
Or maybe it's just that I come into contact on a daily basis with people learning C or C++ as their first language, and the results are never pretty Wink

Why, the Java-only pupils are so much better? Very Happy
[post="76300"]<{POST_SNAPBACK}>[/post]
Yes, they are, as they tend to get stuck on problems to do with program logic or similar rather than the mess of buffer overflows or poor memory management that plague C learners.
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 24 Apr 2006 11:49:19 am    Post subject:

benryves wrote:
Yes, they are, as they tend to get stuck on problems to do with program logic or similar rather than the mess of buffer overflows or poor memory management that plague C learners.

How does Java make a difference there? Neutral Buffer overflows and the like can be easily avoided by disciplined coding (which is helped by additional C++ constructs) and good design. And you need that discipline anyway in handling other kinds of resources. Neither Java nor C# will prevent you from creating a poor architecture, and in the case of Java you have to adapt to braindead libraries that are over- and underengineered at the same time while working out the structure of your application (for the lack of sufficient experience I can't comment on C#)... Writing free() at the appropriate places or getting destructors right isn't that much of a mental burden, and it's irrelevant to higher levels of the problem where the real difficulties are lurking.

Anyway, I never understood why Java and co. are considered so high-level compared to C++ for instance. After all, they all require you to program at the same algorithmic level. To me, the high level starts at Scheme, Prolog, Haskell, Erlang, Icon...
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 24 Apr 2006 12:25:39 pm    Post subject:

CoBB wrote:
benryves wrote:
Yes, they are, as they tend to get stuck on problems to do with program logic or similar rather than the mess of buffer overflows or poor memory management that plague C learners.

How does Java make a difference there?
Java throws an exception, you know you've done something wrong. C or C++ carries on working, but unrelated parts of your program start acting weirdly. That's just an example.

Quote:
Neutral Buffer overflows and the like can be easily avoided by disciplined coding (which is helped by additional C++ constructs) and good design. And you need that discipline anyway in handling other kinds of resources. Neither Java nor C# will prevent you from creating a poor architecture, ...
Of course not. And of course buffer overflows can be prevented by careful coding. However, beginners are not really the most careful of programmers. Simple mistakes, like "if (x = 1)", even affect seasoned programmers and Java or C# would not allow the programmer to make that mistake. I'm all for idiot-proofing, especially when people are learning.

Quote:
...and in the case of Java you have to adapt to braindead libraries that are over- and underengineered at the same time while working out the structure of your application (for the lack of sufficient experience I can't comment on C#)...
You don't need to use those libraries in Java. Even in .NET languages, you can use P/Invoke and write a program that just uses the Win32 API (or any C/C++-type API you so wish). More often that not, however, these libraries are there to help...

Quote:
Anyway, I never understood why Java and co. are considered so high-level compared to C++ for instance. After all, they all require you to program at the same algorithmic level. To me, the high level starts at Scheme, Prolog, Haskell, Erlang, Icon...
They're more of a different programming paradigm. After all, a common beginner's language, after all, is (or was) Logo, which is essentially Lisp (a functional language) without the parenthesis abuse. :)

Note that these are not arguments for managed languages over native languages in a general sense, just for people learning their first language.
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 24 Apr 2006 02:53:15 pm    Post subject:

benryves wrote:
Java throws an exception, you know you've done something wrong. C or C++ carries on working, but unrelated parts of your program start acting weirdly. That's just an example.

In my experience this is rare. In the great majority of cases stale pointers cause an access violation, and the debugger will tell you exactly what happened. And well, although Java emits nice stack traces, I've already had my fights with exceptions that were caught at the wrong place, disguising an error and slowing down the program excessively at the same time. Debugging exceptions is not for the faint of heart.

benryves wrote:
However, beginners are not really the most careful of programmers. Simple mistakes, like "if (x = 1)", even affect seasoned programmers and Java or C# would not allow the programmer to make that mistake. I'm all for idiot-proofing, especially when people are learning.

I think the ugliest bugs I had to track down were due to extra semicolons after for(;Wink headers, something Java doesn't protect you against any more than C...

benryves wrote:
You don't need to use those libraries in Java. Even in .NET languages, you can use P/Invoke and write a program that just uses the Win32 API (or any C/C++-type API you so wish). More often that not, however, these libraries are there to help...

What can you do without libs in Java (without considerable effort)? Pure data manipulation, something that's exactly what Java wasn't made for and doesn't excel at either. And if you ever have to fall back on raw win32, C knowledge is surely on the save.

benryves wrote:
They're more of a different programming paradigm. After all, a common beginner's language, after all, is (or was) Logo, which is essentially Lisp (a functional language) without the parenthesis abuse. Smile

I don't know how common Logo was, but it was sadly outnumbered by Basic one to many. By the way, my ad hoc list does feature an imperative language and another practically imperative one too, so it's not just paradigm pissing. Wink But these paradigms themselves represent a higher level of thinking anyway, and if you are going for fool-proofness, they offer more (IMHO) than simply baby-sitting memory management, since they constrain structuring as well.

benryves wrote:
Note that these are not arguments for managed languages over native languages in a general sense, just for people learning their first language.

Yes, and we certainly agree on what a managed environment entails; the disagreement lies in arguing whether these consequences are harmful or beneficial. As I see it: less worrying, more sloppiness.
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 24 Apr 2006 03:27:56 pm    Post subject:

Umm... CoBB... Ben... stop getting mad at each other. Although this argument is quite productive, it wouldn't be good if some of the brightest z80 ASM programmers stopped talking to each other. After all, you guys are working together on the whole Latenite+PTI suite.
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 24 Apr 2006 05:50:05 pm    Post subject:

Nay, continue. It's a perfectly healthy debate.
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 24 Apr 2006 06:07:29 pm    Post subject:

You can intervene if it gets to flaming (which it won't).
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 25 Apr 2006 12:38:11 am    Post subject:

Liazon wrote:
Umm... CoBB... Ben... stop getting mad at each other.

:biggrin: :biggrin: :biggrin:

You know, I'm not the very same person as Ben, so we're bound to have different views concerning certain things. This isn't the first case anyway, yet we haven't cut each other's throat so far—in the end, I wouldn't worry. :D

Anyone is welcome to join the discussion by the way. I always found it irritating how many people seem to avoid all forms of disagreement, probably confusing it with bad manners.
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 25 Apr 2006 03:37:38 pm    Post subject:

Well, I do agree with Ben that learning problems should mainly be about logic issues, as opposed to syntax/low level issues. I like TIGCC a lot better than ASM because I can quickly write code that is nearly as good as ASM code without having to think of every single register command. Things fit together a bit better and TIGCC gives me warnings of possible problems.

However, in some places I do like ASM better because of the overall control. I think the use of the low-level, memory, and pointer stuff is another part of that logic puzzle called programming. Utilizing the effects of low-level stuff can help optimize, though I'm sure for computers, ASM optimizations would be pretty hard to do by hand; might as well let the compiler give it a shot.

I'm not familiar with C++, Java, or C#, but that's just my opinion on how programming should be.
Back to top
Tiberious726


Advanced Member


Joined: 07 Oct 2005
Posts: 284

Posted: 25 Apr 2006 08:55:04 pm    Post subject:

i agree with CoBB here; it would be different if you are learning ASM v JAVA but in C v JAVA i would say that C has hit the sweet spot between high and low level and can easily be adapted to either; would you recamend that someone start programing in COBOL (my answer is a definitive no) because you become lazy and dont think about what the macheine is actually doing; i wouldn't even recamend BASIC as a first language to anyone; C is human readible/writable enoghe but is still transparent enoghe that you can see what you are doing on the macheine; starting doing your own memory management is like starting in a text editor rather than a full fledged IDE, you learn more by doing it by hand; I am probably rather biased here as a only know a small amount of JAVA and a (comparitivly) large amount of C, but my arguments apply in the general sence of the designs of those two languages and not them specifically.
Back to top
trigkid213


Member


Joined: 30 Mar 2006
Posts: 208

Posted: 27 Apr 2006 02:51:29 pm    Post subject:

Thanks for all the input. I'll probably continue with my plans to learn C++, then learn Java and maybe C.
Back to top
Spencer


Advanced Newbie


Joined: 06 Nov 2005
Posts: 99

Posted: 28 Apr 2006 01:03:05 am    Post subject:

CoBB wrote:
I think the ugliest bugs I had to track down were due to extra semicolons after for(;Wink headers, something Java doesn't protect you against any more than C...
Now that's an achievement. I have a habit of not leaving space for a null when malloc'ing for a string, which often has interesting, and seemingly unrelated consequences.

As for considering Java a HLL, it could go either way. It's high level in its separation from machine code, but on the other hand, offers no advantage over C in algorithm implementation. In fact, due to this ambiguity, I propose a new standard: the more restrictions a language places on the format of its code (e.g. parenthesis, excessive tabbing), the higher level it is. Laughing (lambda (x y) (let ... ah forget it.
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 28 Apr 2006 03:26:59 am    Post subject:

Lisp is multi-paradigm, just for the record. Wink
Back to top
Rakuyoukai


Newbie


Joined: 30 Apr 2006
Posts: 7

Posted: 01 May 2006 12:28:00 am    Post subject:

benryves wrote:
C++ is (as already mentioned) OOP stuff roughly hacked on top of the basic bits of C. Since C++ came about, there have been "real" OOP languages developed (for example Java, now well established and one of the main languages taught in schools, or C# which is rapidly gaining popularity), which are much cleaner and easier than C++. Not to mention that just in time compilers are now excellent, so you can release a single Java/C# binary that runs just as well as the native code on multiple platforms and processors.

Also, note that C++ is not all of C. You can do things in C that you can't in C++ (C99).

The difficulty with C is more to do with having to do things the manual way (for example, strings in C are a comparitive nightmare compared to using the std::string class).

Unfortunately, the software world is very slow to adapt to change, so C++ is probably around to stay for a while. It took them a while to switch from C, after all!

Then again, I'm one of these strange people who doesn't like programming itself, and just likes a programming language let him peform a task with the minimum amount of fuss.

I, personally, would never ever suggest a language like C or C++ as a first programming language, as they give you 101 assorted ways to shoot yourself in the foot.
[post="76220"]<{POST_SNAPBACK}>[/post]



at Sandia National Labs (i have freinds fathers who work there), they use a combination of C,C++, and Visual C. mainly because the engineers there are comfortable with what they learnded at the time they were in colloge. i personally like C


Last edited by Guest on 01 May 2006 12:28:40 am; edited 1 time in total
Back to top
sgm


Calc Guru


Joined: 04 Sep 2003
Posts: 1265

Posted: 02 May 2006 10:04:21 pm    Post subject:

CoBB wrote:
Lisp is multi-paradigm, just for the record. Wink
[post="77344"]<{POST_SNAPBACK}>[/post]


And those paradigms are linked lists, doubly-linked lists, and circular linked lists?
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 03 May 2006 07:24:08 am    Post subject:

What do paradigm and implementation have to do with each other? Neutral Oh, that was a joke, haha. :roll:

In Lisp you can write in procedural and functional fashion, using either structural or OO code (whose OOness the Java-derived folks wouldn't necessarily agree with, but oh well)... While FP is also possible under C++, it requires some wild template abuse and doesn't come natural to the language.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
C++
    » Goto page Previous  1, 2, 3  Next
» View previous topic :: View next topic  
Page 2 of 3 » All times are UTC - 5 Hours

 

Advertisement