Forum: Ruby ruby and C

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5247e7cd27b3d17e949a4008624c1059?d=identicon&s=25 smc smc (Guest)
on 2007-04-24 02:28
(Received via mailing list)
Would it be easier to learn ruby if i knew C/C+/C++ or the other way
around?
5625fece788f2e5f37ead8a8a094638a?d=identicon&s=25 zswu (Guest)
on 2007-04-24 02:56
(Received via mailing list)
I think it's a better way that konw more about OO
3bb23e7770680ea44a2d79e6d10daaed?d=identicon&s=25 M. Edward (Ed) Borasky (Guest)
on 2007-04-24 03:31
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

smc smc wrote:
> Would it be easier to learn ruby if i knew C/C+/C++ or the other way
> around?
>
It is easier to learn *programming* in Ruby than in C/C++. However, the
languages are different enough that if you *need* to know C/C++, I'd
focus on learning that, rather than learning Ruby first.

- --
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.net/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGLV1TIqRAswy4LDARAunrAJ9huLG8ggodLsvajD4DvKVwxia1HACgldxO
lI0RbQtf+Kx0lrcfPowIPyc=
=zlEL
-----END PGP SIGNATURE-----
3afd3e5e05dc9310c89aa5762cc8dd1d?d=identicon&s=25 Timothy Hunter (Guest)
on 2007-04-24 03:49
(Received via mailing list)
smc smc wrote:
> Would it be easier to learn ruby if i knew C/C+/C++ or the other way
> around?
>
I'm biased since I learned C in 1985, but if you don't know C (or
better, assembler) then you really don't know what your program is
doing. The Ruby translator is written in C, the core libraries and many
standard libraries are written in C, and many things in Ruby (printf,
for example) are named after the well-known C equivalents.

There are those who can argue eloquently that you don't need to know
what your program is doing at the C level and they're very persuasive.
At this point I can't decide if they're right or wrong. All I know is
that when I write Ruby code I frequently think about how such-and-such
Ruby abstraction is *really* implemented in C.

In any case you can't go wrong learning C. Somebody said that C is so
pervasive that it's "the atmosphere in which we live."
E92d09efe27bf50a87967c533fae247a?d=identicon&s=25 unknown (Guest)
on 2007-04-24 05:50
(Received via mailing list)
On Apr 23, 5:27 pm, "smc smc" <fixxie.w...@gmail.com> wrote:
> Would it be easier to learn ruby if i knew C/C+/C++ or the other way around?

As others have mentioned, there are pluses and minuses to either
approach.  Here is my take on either scenario:

1. C first, Ruby next: You learn the intricacies and then get spoiled
with the ease-of-use later and appreciate each language.
2. Ruby first, C next: Easy learning with forgivable syntax.  When you
learn C, you'll find it "verbose" and strict.
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-04-24 06:43
(Received via mailing list)
get the book by Chris Pine, Learn to Program.
It's cheap and small and interesting. Mr. Pine uses it to teach
beginning programming to kids. He chooses to teach them Ruby rather
than other languages. Ruby gets out of the way most of the time. It
lets you focus on the skill of creating a program. Designing it and
testing and running it. In C this is a much more complicated task. If
you starting out, C will throw a lot of things at you at once.
If you need to learn some programming concepts, Ruby is a great place
to start.

But learning C is a good goal too. It really is the Latin of computer
languages. Many ideas and traditions come out of decades of C culture.

That said, either way you'll be fine, but get yourself a good text
editor which does colors and (if possible) auto completion. Learn to
use the command line too. Buy a good reference book for Unix.
Ac0085dae0703db56ad7f8cb9e1798ba?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2007-04-24 07:02
(Received via mailing list)
John Joyce wrote:
> get the book by Chris Pine, Learn to Program.

http://pine.fm/LearnToProgram/

To sneak a peak, you can find a complete tutorial (I don't have the book
itself, and thus cannot comment on the completeness of the content in
comparison to the book) to programming in general and Ruby especially.

Of course, _why's poignant guide shouldn't be amiss in Ruby specific
tutorials.

> It's cheap and small and interesting. Mr. Pine uses it to teach
> beginning programming to kids. He chooses to teach them Ruby rather than
> other languages. Ruby gets out of the way most of the time. It lets you
> focus on the skill of creating a program. Designing it and testing and
> running it. In C this is a much more complicated task. If you starting
> out, C will throw a lot of things at you at once.

I can recommend "C++ for Dummies" if you are new to C/C++. I haven't yet
had the patience to learn C/C++, though, but found the book a valuable
resource when I was dabbling in C/C++.
A tidbit of information: C has become a subset of C++, which, upon more,
introduced OOP to the C world.


> That said, either way you'll be fine, but get yourself a good text
> editor which does colors and (if possible) auto completion. Learn to use
> the command line too. Buy a good reference book for Unix.

Look long and hard for a good text editor / IDE (once you know what your
IDE should be able to do). What works for me, doesn't work for you (I
don't really like Eclipse, but I like NetBean's Ruby support, for
example).

Get used to reading loads of documentation, most of which is dry and
boring, but packed with information.

Don't just get a Unix book, but install yourself a Linux / Unix derivate
(Ubuntu is a very good choice if you never, ever touched *nix). Darwin
(Mac OS X's Unix core) is available as download, too.

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Eek! That was supposed to be My Special Law, _MY_ special law, I tell
you!

T/
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-04-24 07:47
(Received via mailing list)
On Apr 24, 2007, at 2:01 PM, Phillip Gawlowski wrote:
> http://pine.fm/LearnToProgram/
>
> To sneak a peak, you can find a complete tutorial (I don't have the
> book itself, and thus cannot comment on the completeness of the
> content in comparison to the book) to programming in general and
> Ruby especially.

It's an intro. Doesn't go into bigger topics. Focus on fundamental
things.

> Of course, _why's poignant guide shouldn't be amiss in Ruby
> specific tutorials

Of Course!

>
> I can recommend "C++ for Dummies" if you are new to C/C++. I
> haven't yet had the patience to learn C/C++, though, but found the
> book a valuable resource when I was dabbling in C/C++.
> A tidbit of information: C has become a subset of C++, which, upon
> more, introduced OOP to the C world.

Actually, C and C++ are still very closely related, but have
officially and technically branched off. C++ is no longer a superset
of C
however, Objective-C is a superset of C. Meaning, all C is valid
Objective-C. Not so with C and C++. (though we can say that most
small C programs probably are valid C++ programs)

C is not bad to learn, just painful at times (debugging) it is still
all around you, everywhere. That mobile phone in your pocket? C is in
it. In most single-purpose devices. Systems engineers use it all the
time. Ruby can be used to test and check C! Even to generate C.
5247e7cd27b3d17e949a4008624c1059?d=identicon&s=25 smc smc (Guest)
on 2007-04-24 09:12
(Received via mailing list)
looks like im going to be trying to learn C...
9dec3df8319c613f6f4f14a27da0fdb4?d=identicon&s=25 Kyle Schmitt (Guest)
on 2007-04-24 16:17
(Received via mailing list)
Late in the conversation but...
I learned the canonical basics (Apple &Q) of childhood, then Pascal.
then C++, then C...
It really wasn't a good way to go.

You're right to learn C first.  It teaches you many of the good habits
people used to proclaim were taught by Pascal, except unlike Pascal,
it's useful.  Once you start coding in Ruby, you may not use your C
much, but it's one of those languages you should at least be able to
read.  Being able to read C, and having at least written some C, is to
a programmer like being able to read a circuit diagrams and
greek-letter laden papers is to an engineer.  You don't have to be an
expert in writing it if you're not programming in it, but you should
be able to read it and understand it.

Learning C++ before C is painful, and then it will take great work to
get your C skills up to snuff.  Learning C++ for your OO stuff may be
painful as well.

Since you're planning on learning some C, maybe learn C, learn ruby,
then if you want to branch out to OO in C, learn C++ :)
(obj C is a cool choice too, but not widely used outside of OSX)
Ae16cb4f6d78e485b04ce1e821592ae5?d=identicon&s=25 Martin DeMello (Guest)
on 2007-04-24 16:28
(Received via mailing list)
On 4/24/07, smc smc <fixxie.wits@gmail.com> wrote:
> Would it be easier to learn ruby if i knew C/C+/C++ or the other way around?

One of the first things you'll learn is that C/C++ is an uneasy
pairing - despite C++ being based on, and backward-compatible with C
they're pretty different languages.

martin
1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-04-24 17:04
(Received via mailing list)
Don't quit Ruby though. It's different enough from C that one may
make the other make sense in a way.
It doesn't hurt to learn C first, but it isn't necessary to master it.
You will indeed find that other languages do things the way you wish
C did. C is really bare bones stuff. It's hard to feel productive and
useful with it compared to interpreted languages like Ruby, Perl,
Python or PHP.
Much terminology comes from C or before, and many fundamental
concepts are well established in C books, but don't feel like you
have to learn one language at a time. (more than 2 at a time would be
difficult though)
Most of them have a lot in common, so many things will carry over.
Many languages even look and work a lot like C does, but Ruby
certainly does have a particular beauty about it.
Learn both.
Many people do indeed use multiple languages. Certain languages are
good at certain things.
Some concepts are better illustrated and easier to manage mentally
with some languages.
481b8eedcc884289756246e12d1869c1?d=identicon&s=25 Francis Cianfrocca (blackhedd)
on 2007-04-24 19:13
(Received via mailing list)
On 4/23/07, smc smc <fixxie.wits@gmail.com> wrote:
>
> Would it be easier to learn ruby if i knew C/C+/C++ or the other way
> around?



Are you looking to have fun, or to acquire marketable skills? If you're
tempted to say "both," you should probably think a little harder because
the
answer differs.

If you want to have fun, learn C, then C++, then Ruby. Nothing is more
fun
than understanding what you're doing at a deep level, and building on
that
foundation to learn higher-level things. I learned assembler before I
learned C before I learned C++ (and have been a professional at all of
them,
where "professional" is defined as "getting paid consistently for doing
it"). But before I ever approached computers, I learned how to design
digital logic at the hardware level (gates, circuits, voltage
regulators,
all of it). Then when I first looked at assembly languages, they made
complete and intuitive sense from the first minute. Needless to say, my
reaction to C was "Wow, what a high-level language this is!" I never had
conceptual trouble with pointers because I know exactly what they mean
at
the electronic level.

It's a different question if you're looking for marketable skills
(although
taste plays a big role because you need to ask yourself what you will
actually enjoy working with every day).

It's been long predicted, but we may finally be starting to see a split
between hard-core systems programmers (for which the demand is really
rather
low), script-level coders, and "business" analysts who probably won't
ever
write a line of code at all. As the economics of software development
change, these layers may become more clearly delineated and less
permeable
in the marketplace. I think Ruby has helped drive this change because it
really is becoming more possible to cut together significant and
valuable
applications from system-level pieces using scripting. (Java tries to do
this at the library level, less successfully, although the terrific
amount
of effort that goes into the attempt shows you that the principle at
work is
a compelling one.)

So if you want to be in the middle layer (probably the mainstream going
forward), there's nothing wrong with learning Ruby first. You would do
well
to learn Java too (though I'm hesitant to recommend that, not because of
inherent problems with Java but rather because most Java pedagogy is of
the
mindless, cookbook variety.)

Flame away. I can anticipate objections to this argument in two basic
forms:
1) "What you're talking about hasn't happened yet, therefore it won't
happen
in the future," and 2) "Language XYZ is the best language in the world
[for
some local definition of "best"] and therefore everyone should learn it
first!" I'll be very interested in hearing any counterarguments that are
not
isomorphic to one of these.
425cab08658a06567879717de154552c?d=identicon&s=25 Ari Brown (Guest)
on 2007-04-25 02:56
(Received via mailing list)
On Apr 24, 2007, at 12:42 AM, John Joyce wrote:

> get the book by Chris Pine, Learn to Program.
Chris Pine's book, I must say, is rather great. He teaches you one
things at a time, and explains everything thoroughly. You could learn
a lot of Ruby from that book in two days. I did.

> But learning C is a good goal too. It really is the Latin of
> computer languages. Many ideas and traditions come out of decades
> of C culture.
Anyone know much about D? It's an alternative to C, with cleaned up
syntax and garbage collection. There are a lot of other features,
too, but I don't know them. Check it out if you're even slightly
interested.

> That said, either way you'll be fine, but get yourself a good text
> editor which does colors and (if possible) auto completion.
For macs, Aquamacs is an amazing TE. It's free (not sure if it's open
source), and has coloring (from the themes) and auto-tabbing (Ctrl-
Alt-Backslash). By far my favorite text editor. There's also
TextMate, but I haven't used it yet.

---------------------------------------------------------------|
~Ari
"I don't suffer from insanity. I enjoy every minute of it" --1337est
man alive
This topic is locked and can not be replied to.