You are not logged in.

#26 2009-07-29 23:11:15

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: What should I learn next?

ljshap wrote:

All the Graphical GUI's  I looked at used C++ not C.

You didn't look at Gtk+?

I think that if you use C++ "just" for the few features mentioned (function overloading, default arguments, and strings) you should seriously consider asking yourself why you're using C in the first place.  It's a bit like buying an SUV instead of a sedan because you like the color.

Offline

#27 2009-07-30 02:05:16

ljshap
Member
From: Ossining, NY
Registered: 2008-01-23
Posts: 160

Re: What should I learn next?

Trent wrote:
ljshap wrote:

All the Graphical GUI's  I looked at used C++ not C.

You didn't look at Gtk+?

I confess I did.  Its been a while since I looked at the various gui's and decided on QT, he said humbly, admitting his mistake!   


I think that if you use C++ "just" for the few features mentioned (function overloading, default arguments, and strings) you should seriously consider asking yourself why you're using C in the first place.  It's a bit like buying an SUV instead of a sedan because you like the color.

I think your analogy is way too strong.  If you learn C++ you also learn C except you have the choice between C functions or C++ classes not vice-versa.  At that point learning the difference between malloc vs. new or printf vs. cout is pretty trival since you will have the basics of both C and C++.  Am I saying one should spend all the time and effort into learning the ins and outs of OOP just to use the few features I mentioned  ---  OF COURSE NOT !!!!   Learning the OOP aspects of C++ at its most BASIC, ELEMENTARY and LITERAL level is not that difficult, although it does get extremely hairy quickly.   

  I've worked on C++ programss using OOP classes as well as C++ programs just for the features I mentioned since using OOP would have made no sense.   The task should determine what you use.  I just don't see any disadvange in using C++ when all I need are a few of the non OOP extensions to C.

  Disclaimer:  All my comments should be taken with a grain of salt since I'm stricly an amateur.


Live Free or Die !

Offline

#28 2009-07-30 03:38:13

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: What should I learn next?

Function overloading: Not easy in C, if even possible to any significant extent. You could probably hack something together with stdarg.h, but it would be ugly.
Default arguments: See above. Also, I would argue that a well-written function should not need either of these two features under most circumstances.
Strings: Strings are absolutely a pain in straight C. C++ gives you a nice STL class to use, but it doesn't teach you how strings actually work — considering that the OP is trying to learn a language and its associated skills, not just find a good one to use, I'd say C is the better choice here despite the inconvenience of rolling your own.

In other words, for learning purposes, C is best. For getting projects out the door really fast, C++ wins (but Python wins more).

Offline

#29 2009-07-30 04:01:13

&#32 Greg
Member
Registered: 2009-02-08
Posts: 80

Re: What should I learn next?

Peasantoid wrote:

Function overloading: Not easy in C, if even possible to any significant extent. You could probably hack something together with stdarg.h, but it would be ugly.
Default arguments: See above. Also, I would argue that a well-written function should not need either of these two features under most circumstances.
Strings: Strings are absolutely a pain in straight C. C++ gives you a nice STL class to use, but it doesn't teach you how strings actually work — considering that the OP is trying to learn a language and its associated skills, not just find a good one to use, I'd say C is the better choice here despite the inconvenience of rolling your own.

In other words, for learning purposes, C is best. For getting projects out the door really fast, C++ wins (but Python wins more).

And then it becomes a race between how much resources you're willing to use and how long you're willing to spend coding it...

Offline

#30 2009-07-30 12:23:23

joephantom
Member
From: Latinoamérica
Registered: 2008-01-09
Posts: 94
Website

Re: What should I learn next?

Learn Java, then C, C++, finally Lisp and Haskell.

I recommend you reading articles from this site:
http://www.defmacro.org/

For example a cool text about functional programming is the following one:
http://www.defmacro.org/ramblings/fp.html


By striving to do the impossible, man has always achieved what is possible. Those who have cautiously done no more than they believed possible have never taken a single step forward - Mikhail Bakunin

Offline

#31 2009-07-30 12:43:32

scio
Member
From: Buffalo, NY
Registered: 2008-08-05
Posts: 366

Re: What should I learn next?

Peasantoid wrote:

...considering that the OP is trying to learn a language and its associated skills, not just find a good one to use, I'd say C is the better choice here despite the inconvenience of rolling your own.
In other words, for learning purposes, C is best. For getting projects out the door really fast, C++ wins (but Python wins more).

I see where you are coming from, I guess I interpreted learn differently.  When I learn a language it is usually to be able to understand and write code.  I may not get all the inner workings right away but I will have a good understanding of examples in no time.  My point with C++ was that you will quickly know all the basics of C as well as exposure to STL and the like.

Either way, try to at least skim the surface of as many languages as possible.  I really don't know as much as I would like to about functional languages, but I have seen/used a few.

Offline

#32 2009-07-30 13:43:04

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 714

Re: What should I learn next?

haskell is nice to learn, functional programming can help you think different about making a porgram. For me it was fun and interesting to learn

Offline

#33 2009-07-30 14:04:29

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: What should I learn next?

scio wrote:

I see where you are coming from, I guess I interpreted learn differently.  When I learn a language it is usually to be able to understand and write code.  I may not get all the inner workings right away but I will have a good understanding of examples in no time.  My point with C++ was that you will quickly know all the basics of C as well as exposure to STL and the like.

I agree with your point of view: there's no reason to learn how Python or Haskell represents their types internally. That's the reason I recommend learning C insted of C++, he'll have a more high-level approach with C++ and he won't learn how strings work at a less higher level.

I don't know exactly how lists are implemented in the n existing implementations, but I do know how to implement a list in C, and this helped me to understand what a "car" and a "cdr" are.


(lambda ())

Offline

#34 2009-07-30 17:00:05

scio
Member
From: Buffalo, NY
Registered: 2008-08-05
Posts: 366

Re: What should I learn next?

andre.ramaciotti wrote:

I don't know exactly how lists are implemented in the n existing implementations, but I do know how to implement a list in C, and this helped me to understand what a "car" and a "cdr" are.

Hm, never thought about a list in C in relation to car and cdr.  I always think of car and cdr in terms of linked lists.  Of course if you want to get really fancy, you can use car and cdr in C++: http://www.boost.org/doc/libs/1_39_0/li … /cons.html

Offline

#35 2009-07-30 17:45:43

benob
Member
Registered: 2008-11-11
Posts: 187

Re: What should I learn next?

scio wrote:

Almost forgot, one of my favorite ways to learn languages is to use:
http://projecteuler.net/

Just for inspiration beyond tutorials.

projecteuler is just great. More than learning languages, learn how to think like a programmer. And for this, you need to solve non-trivial problems.

Also, try to reimplement all data structures that are taken for granted in python. Start with different kinds of lists, hash tables and trees. Then, do the same thing in multiple languages, to learn the syntax. As for "the library", learning to read a documentation should do the trick. Almost all basic blocks have been implemented similarly in various languages. Just learn to use them.

Last edited by benob (2009-07-30 17:46:12)

Offline

#36 2009-07-30 18:07:18

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: What should I learn next?

scio wrote:
andre.ramaciotti wrote:

I don't know exactly how lists are implemented in the n existing implementations, but I do know how to implement a list in C, and this helped me to understand what a "car" and a "cdr" are.

Hm, never thought about a list in C in relation to car and cdr.  I always think of car and cdr in terms of linked lists.  Of course if you want to get really fancy, you can use car and cdr in C++: http://www.boost.org/doc/libs/1_39_0/li … /cons.html

I think I may have been misunterstood, so I'll say it again in a different way to avoid this.

When I first took a look at Lisp, and didn't actually understand what a bloody list was (I was a beginner at the time). I saw that diagrams with rectangles divided at middle, with arrows pointing each other... it was a chaos. Then, some time later, I learnt how to program simple linked lists in C, and that was an epiphany about how lists worked in Lisp, too.

I don't think about linked lists in C as car and cdr, but I did the opposite. Thinking of a cons cell as something like the code below helped me alot to grasp it when I was learning Lisp, while that diagrams only confused me. Nowadays it's natural, though.

struct cons {
    void *car;
    void *cdr;
};

(lambda ())

Offline

#37 2009-07-30 19:31:12

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: What should I learn next?

ljshap wrote:

I think that if you use C++ "just" for the few features mentioned (function overloading, default arguments, and strings) you should seriously consider asking yourself why you're using C in the first place.  It's a bit like buying an SUV instead of a sedan because you like the color.

I think your analogy is way too strong.  If you learn C++ you also learn C except you have the choice between C functions or C++ classes not vice-versa.  At that point learning the difference between malloc vs. new or printf vs. cout is pretty trival since you will have the basics of both C and C++.  Am I saying one should spend all the time and effort into learning the ins and outs of OOP just to use the few features I mentioned  ---  OF COURSE NOT !!!!   Learning the OOP aspects of C++ at its most BASIC, ELEMENTARY and LITERAL level is not that difficult, although it does get extremely hairy quickly.

On the surface, C and C++ may appear similar, and the differences between malloc/new, printf/cout, etc. may seem trivial.  But if you're saying that learning C++ prepares you to use C... no, I'm not buying that.  Not that the skills aren't transferable, but in my opinion they should be learned as two different languages.  Writing vanilla C code in an otherwise C++ program looks like a hack.

I've worked on C++ programs using OOP classes as well as C++ programs just for the features I mentioned since using OOP would have made no sense.   The task should determine what you use.  I just don't see any disadvange in using C++ when all I need are a few of the non OOP extensions to C.

I guess I'm saying that without the OOP features of C++, minor features of the tripe you mentioned are of limited usefulness.

Offline

Board footer

Powered by FluxBB