Re: Large Ruby Apps ?



On Thu, 22 Sep 2005, klancaster1957@xxxxxxxxx wrote:

I don't know why anyone would consider having tools (like compilers) help
catch errors as "old school".

because they don't catch that many serious errors

  harp:~ > cat a.c
  #include <stdlib.h>
  #include <stdio.h>
  #include <limits.h>
  int
  main ()
  {
      fprintf (stdout, "%lu : %lu\n", ULONG_MAX,
                 ULONG_MAX + (random () > 42 ? 1 : 0));
        (void) fgets (NULL, (signed long) ULONG_MAX, NULL);
          while (1)
                malloc (42);
  }


harp:~ > gcc -Wall a.c


harp:~ > echo $? 0

line one is an error. line two core dumps. line three will hang your machine.

all compile perfectly with all warnings on.  we all know runtime errors are,
by far, the most difficult and time consuming to detect anyhow - and the
compiler doesn't save you from any of those other than the most trivial.
also, it's a known fact that bugs are linearly proportional to tloc - and
compiled languages tend to be more verbose to a degree of 10 times or more so
letting even 1 in 10 errors through puts you right back at square one.

Personally, I want every tool I use to help me catch my goofs.

me too. in particular

  - garbage collection
  - powerful object introspection
  - compile time as runtime
  - no pointers
  - powerful and easy to use exception handling
  - ability to express code in fewest lines possible : abstraction
  - strong typing and dynamic typing.  ruby is both
      http://en.wikipedia.org/wiki/Dynamic_typing
      http://en.wikipedia.org/wiki/Weak_typing
      http://en.wikipedia.org/wiki/Strong_typing
      http://www.mindview.net/WebLog/log-0066
  - uniform object model
  - easy and quick testing framework
  - easy to use logging

I've just started using Ruby, and while I am jazzed with the language and
really excited about Rails in particular, the relative lack of support for
static code checking and runtime debugging as compared to C#/Java/etc. is a
little disconcerting. In those languages, I rely on unit testing, static
checkers, AND runtime checking to insure that I get it right.

a valid concern, but i'd urge you to write some large ruby programs before weighing it too heavily. i've been writing pretty much nothing but ruby for 5 years now and have never, like never, required a debugger or spent more that an hour debugging my code. i have many, many systems running 24x7 that are more than 5000 lines of code (that's probably around 25,000 lines of java) and none, like none, of them have ever crashed. i'm the kind of guy that doesn't even run c or c-- code out of the debugger and who always fully qualifies and c functions with as many consts as i can and i will say this to you - i can produce large bodies of useful robust code in ruby at a minimum of 10 times faster than i can in c, c--, or java and i've written large near-realtime systems in all of them. it boils down to this: everything in the world is a tradeoff and, though you do give some things up in ruby, you gain many more. my experience, and the experience of every single programmer i know that has made the leap is that your productivity of __robust__ code will increase dramatically using a strong and dynamically typed real object oriented language.

2 cts.

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze.  --Nagarjuna
===============================================================================

.



Relevant Pages

  • Re: Not quite getting it.
    ... static typed languages have a problem finding logical ... But so does Ruby since it doesnt even have compiletime. ... Ruby cant fint logical flaws at compile time either (due to lack of ...
    (comp.lang.ruby)
  • Re: AppleCommander 1.3.5.2
    ... Ruby code - no more having to remember yet another syntax, well, ... of those other languages. ... simply batch files to generate my macro file, compile my program and, if ... execute or debug my program. ...
    (comp.sys.apple2.programmer)
  • Re: Dynamic code generation and linking
    ... and link in c code (and potentially other languages, including assembly - but c is my primary interest), from within Ruby. ... I mean have the compiled code immediately become available for use by the Ruby script that asked for the compilation. ... It should be possible to specify a grammar with a Rubyish domain specific language, and then compile that to native code and immediately make use of it from within the same Ruby program. ... A further possibility is that it could pull all that pesky linking with external libraries in to the domain of Ruby, and make it a fun thing to explore from within IRB, for example. ...
    (comp.lang.ruby)
  • Re: How to avoid undesired default values?
    ... I am using "gfortran" to compile my codes. ... If you did know you would not be debugging. ... What do you think of subscript range checking as a debugging feature? ...
    (comp.lang.fortran)
  • Re: Yielding an object and caring about the result: the cousin of Object#tap
    ... making debugging for some poor soul a ... little in the way of clarity or maintainability in production code. ... should, in something as beautiful as ruby, end up looking like ... the intent is muddled by ...
    (comp.lang.ruby)