Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,002 members, 7,821,514 topics. Date: Wednesday, 08 May 2024 at 02:11 PM

How Dyu Do This In Ruby? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How Dyu Do This In Ruby? (754 Views)

Why I Love Ruby / How Dyu Play Mp3 files In Java? (2) (3) (4)

(1) (Reply)

How Dyu Do This In Ruby? by kambo(m): 6:02pm On Jun 16, 2013
I strted out to teach myself ruby for d sake of variety . I had as my tutors circa 4 ebooks on ruby.
The pick axe book, one by david flanagan (author of javascsipt bible), pragmatic programmer , and steve holtzners beginng ruby on rails.
I downloaded and unzipped a rails package, whipped up my fav editor nd strted typing away.
First off all, ruby's terseness and neatness got to me. Inspired by python's philosophy but havg my code lyng around bare bodied in some folder got me twitchg some. All these scriptg langs and their nudist culture sef , mayb cuz thema still young and nubile relative to older ones frm generations way back.
Php,python,perl all share this bare all phylosophy.
I'm not comfrtable handg off my hard earned brain benches to some just like tht.
But i plodded on, wantg to experience d gem they say is hidden in ruby.
The compiler errors didnt help me ,it was like greek, somthg i'm not used to wth java.
Java aint so clear but after gettg used to it ,i see it is really helpful.
Its compiler error messages point out d problem (and line number) adequately.
One problem had me tearng my hair out, i spent an hour+ debugging it, i entered d textbook example word 4 word and d compiler returned d same gripe word 4 wrd but its message cud hav well been written in mandarin chinese for all its wrth- it was useless to me.
After much pain and many trials and error, i discovered d cog tht was hinderg: my class name didnt begin with capital letter! The compiler cudve simply said so! Y didnt it say so!
(this is one reason open source perennially lags behind. For all their smart gadgets they stew in subpar documentation makg their tools unusable,to most.)
havg scaled tht breakpoint, i gathered my self together and decided to write somtin tht wud really require me to employ many of d concepts of ruby. Somtin relatvly simple,tht cud b whipped up in a couple of minutes in java.
A linked list.
I tried and tried and combed all d books to ensure i was layg it all right but this time tearg my hair out and pickg my code and books apart with a needle ddnt help me.
Stuff didnt compile , i mean satisfy the interpreter's rule set.
Seeing i was gettg nowhere , i decided to to try the same long hand,i.e in java,
i wrote it,wincing at the uncomfortable verboseness of uncle J. I'd gotten used to sayg 'puts' instead of 'System.out.pr..... '
. Man, typing out my logic in java seemed like secretarial labour rather thn codg!. But i was soon thru wth d first draft.i saved the source file and , with bated breathe, happens all d time i'm invokg javac on a new meal (source file), i hit ENTER to summon javac. The screen was dark,as usual, the cursor was blinking , i was waitg tense 4 d screen to spatter wth error messages , thngs i ddnt do rght-d frst time.
I was debug ready. The blink took longer thn usual, then, the blankness, dissapeared and the typical path signature was restored. The code i wrote in java compiled at frst attempt. I had my .class twins sittg snugly besides their .java bro. Still doubtful,tht it was wartless,i tested the linklist,
it perfrmed like an olympic athlete in a local country race-flawless.
So the problem wasnt in my logc but in my ruby syntax. And hidden by shabby ruby documentation includg poorly wrttn tech books- d bane of the tech industry.
I experienced similar road block wen xplorg python, in this case, perfrmg d equivalent in java of importg a package.
Enough rambling then.
If ur a ruby fan, show me wrkg code tht addresses d problem tht stumped so bad tht i kicked d gem 2 d curb. Post code here 4 a single (double if u wish) linkedlist.
I'll test it and compare it to mine to see where i went amiss.
Re: How Dyu Do This In Ruby? by kambo(m): 3:43am On Jun 18, 2013
Aint no ruby programmer in the house?

ok. i'm rephrasing the question: short form:

" what is the working code for a linked list in ruby? show me!. "

Man , it will be a shame if a whole programming section in NL can't even respond to this.

It works for me on java but on ruby i cant get it work!!. need working code.

(1) (Reply)

Where To Find Css And Html Tutorial / Free Tutorials And Resources For Web/mobile Application Development / International Clients Won't Give Me Job Because Am From Nigeria

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.