training

Kevin Fries kevin at fries-biro.com
Mon Dec 19 13:53:14 MST 2011


I would pick one.

Bash can help you learn the ideas of for-next loops, variables, etc.
Any programming language can do that.  The goal here is to learn
programming techniques.  So, I would pick one.  Bash is great, and
teaches structure (if done right), but is not much fun for learning
programs that do fun things.  So, if this was your decision, I would
stick to the ruby, then later learn Bash to manipulate what you wrote in
Ruby.  That way, you can pile on new knowledge onto what you learned
before.

Ruby, like many languages have many different ways of doing things.
Learn them all and have fun with it.  Learn to tinker, and pay attention
to cause and effect.

So, many languages have the idea of a for-next loop (i.e. my bash
comment above) and they mostly go like this:

   for x=1 to 10
      print x
   next

Ruby can do this:
   for x in [1..10]
      print x
   end

or this:
   [1..10].each {|x| print x}

or this:
   x.times {|x| print x}

These may look very different to a beginner, but they are actually
identical.  When might I use one form or the other?  As a learner, I
suggest you play with it and find out that there are slight differences,
and what they are.  At this point, it is more important to have fun and
play, and it is to get caught up in syntax.

Most important, enjoy yourself.

And, as for your C problem... You probably did a #include on "stdio.h",
then placed your exit in a location that made C think it was being
defined as a prototype.  Therefore, it thought you were trying to
override the definition that was already in place.

Kevin



On Mon, 2011-12-19 at 13:38 -0700, Michael Havens wrote:
> I think I'll take Kevin's advice. After googling the differences
> between OO and procedural programming it looks to me as if the natural
> progression for a beginner would be to learn bash and then learn Ruby.
> Would trying to learn both at the same time be wise or not? You know,
> finding good teaching material can be so difficult; could someone
> recommend a good pdf or something that teaches Kevin's
> recommendation?
> 
> The reason I'm taking this advice is after trying to compile the
> second program I kept getting errors and I had no idea what they were
> saying. (see below). I think what it is saying is that the error is in
> line 28 character 3. But it looks exactly like the instructions are
> telling me to make it! [ 'exit(1);' ] (w/o the square brackets or
> apostrophes).
> 
> argexample2.c: In function ‘main’:
> argexample2.c:28:3: warning: incompatible implicit declaration of
> built-in function ‘exit’ [enabled by default]
> 
> 
> On Mon, Dec 19, 2011 at 10:50 AM, Kevin Fries <kevin at fries-biro.com>
> wrote:
>         I respectfully disagree.
>         
>         C is a GREAT language.  It is as powerful a modern language as
>         you will
>         find.  But IMHO, learning to program in C, is like learning to
>         hit a
>         fast ball from Randy Johnson.  Learn to crawl before you walk.
>         
>         You have two different camps on the programming front:
>         Procedural and
>         Object Oriented (OO).  And because black and white are just
>         too
>         limiting, you have a billion shades of gray in between.
>          Languages that
>         incorporate pieces of both camps.
>         
>         For pure OO programming, you really only have one choice in a
>         modern
>         language, Ruby.  It takes OO to a purist stage, and therefore
>         is my
>         choice in recommendation for learning this style of
>         programming.  Once
>         you learn pure OO, you will be able to appreciate the non-pure
>         elements
>         of languages like Python, Java, and C++.
>         
>         For procedural programming, I generally suggest, Bash.  Yep,
>         Bash.  It
>         has many of the features you need, without allowing you access
>         to step
>         on other programs (bad pointer assignments, or even pointers
>         at all).
>         From Bash, I like to look at (at least from a training
>         standpoint) Perl
>         as a more complex version of bash.  It will fill in many of
>         the missing
>         pieces.  As Keith said, if you then go on to C, C will make
>         many of the
>         other languages far more clear.  C opens up all the keys to
>         the kingdom.
>         But until you know enough to understand the questions, C can
>         be
>         overwhelming.  I recommend learning C, but only once you
>         understand
>         programming better.
>         
>         Some people say, to learn a procedural language first, then
>         learn object
>         orientation.  Others say learn OO, its more modern and then go
>         on to
>         procedural languages like C only if you need to.  My opinion
>         is that it
>         does not matter.  As a professional programmer, and Sys Admin
>         (I work
>         both sides of this fence), I have different needs for
>         different
>         situations.  As a professional I mix multiple languages
>         together quite
>         often (right now I am working on a multi-platform [i.e. Linux,
>         Mac, and
>         Windows] library, so I am using Ruby, then making it
>         accessible to
>         automation on our Linux servers by writing a Bash access
>         library on top
>         of that).  So, I say, just learn one, don't worry about it.
>         
>         The difference between OO and procedural is organizational.
>          An integer
>         is an integer, a string is a string, but how you manipulate it
>         may
>         differ.  Its more important that you get programming concepts
>         down, than
>         it is to learn any one particular language.
>         
>         My advice, and I have given this often... Learn Ruby.  IRB
>         gives you an
>         excellent playground.  Its interpreted so you do not have to
>         deal with
>         the compile/make cycle.  And you can build some useful,
>         multi-platform
>         things with it.  You can extend it with a Web Application
>         platform
>         (Rails), and run may of your programs on Windows and Macs, not
>         just
>         Linux.  Show off your work, and get encouragement from
>         others.  Once you
>         feel like you know what you are doing... Pick another
>         language, like
>         Perl, or C.
>         
>         The most important advice is, sorry Nike, Just Do It.
>         
>         Kevin Fries
>         
>         
>         
>         On Mon, 2011-12-19 at 09:23 -0800, keith smith wrote:
>         >
>         > I would second starting with C.  I learned and used several
>         languages
>         > before taking a C class.  C helped me understand the others.
>         >
>         
>         
>         ---------------------------------------------------
>         PLUG-discuss mailing list -
>         PLUG-discuss at lists.plug.phoenix.az.us
>         To subscribe, unsubscribe, or to change your mail settings:
>         http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>         
> 
> 
> 
> -- 
> :-)~MIKE~(-:
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss




More information about the PLUG-discuss mailing list