Justin Gehtland

author
+ Follow
since Jan 30, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Justin Gehtland

By the way, I just tried your example. I opened irb, and typed:

> 2**2**2**2**2

in just under a quarter of a second, I got this result:

20035299304068464649790723515602557504478254755697514192650169737108940595563114530895061308809333481010382343429072631818229493821188126688695063647615470291650418719163515879663472194429309279820843091048559905701593189596395248633723672030029169695921561087649488892540908059114570376752085002066715637023661263597471448071117748158809141357427209671901518362825606180914588526998261414250301233911082736038437678764490432059603791244909057075603140350761625624760318637931264847037437829549756137 70981604614413308692118102485959152380195331030292162800160568670105651646750568038741529463842244845292537361442533614373729088303794601274724958414864915930647252015155693922628180691650796381064132275307267143998158508811292628901134237782705567421080070065283963322155077831214288551675554073345107213112427399562982719769150054883905223804357045848197956393157853510018992000024141963706813559840464039472194016069517690156119726982337890017641517190051133466306898140219383481435426387306539552 96969138802415816185956110064036211979610185953480278716720012260464249238511139340046435162386756707874525946467090388654774348321789701276445552940909202195958575162297333357615955239488529757995402847194352991354376370598692891375715374000198639433246489005254310662966916524341917469138963247656028941519977547770313806478134230959619096065459130089018888758808473362595606544488850144733570605881709016210849971452956834406197969056546981363116205357936979140323632849623304642106613620022017578 78518574091620504897117818204001872829399434461862243280098373237649318147898481194527130074402207656809103762039992034920239066262644919091679854615157788390603977207592793788522412943010174580868622633692847258514030396155585643303854506886522131148136384083847782637904596071868767285097634712719888906804782432303947186505256609781507298611414303058169279249714091610594171853522758875044775922183011587807019755357222414000195481020056617735897814995323252085897534635470077866904064290167638081 61740550405117670093673202804549339027992491867306539931640720492238474815280619166900933805732120816350707634351669869625020969023162859350071874190579161241536897514808261904847946571736601005892476655445840838334790544144817684255327207315586349347605137419779525190365032198020108764738368682531025183377533908861426184800374008082238104076468878471647552945326947661700424461063311238021134588694532200116564076327023074292426051582811070387018345324567635625951430032037432740780879056283663406 96503084422585596703927186946115851379338647569974856867007982396060439347885086164926030494506174341236582835214480672667684180708375486221140823657980296120002744132443843240233125740354501935242877643088023285085588608996277445816468085787511580701474376386797695504999164399828435729041537814343884730348426190338884149403136613985425763557710533558020662218557706008255128889333222643628198483861323957067619140963853383237434375883085923372228464428799624560547693242899843265267737837317328806 32107532112386806046747084280511664887090847702912081611049125555983223662448685566514026846412096949825905655192161881043412268389962830716548685255369148502995396755039549383718534059000961874894739928804324963731657538036735867101757839948184717984982469480605320819960661834340124760966395197780214411997525467040806084993441782562850927265237098986515394621930046073645079262129759176982938923670151709920915315678144397912484757062378046000099182933213068805700465914583872080880168874458355579 26258465124763087148566313528934166117490617526671492672176128330845273936469244582892571388877839056300482483799839692029222215486145902373478222682521639957440801727144146179559226175083889020074169926238300282286249284182671243405751424188569994272331606998712986882771820617214453142574944015066139463169197629181506579745526236191224848063890033669074365989226349564114665503062965960199720636202603521917776740668777463549375318899587866282125469797102065747232721372918144666659421872003474508 94283091153518927111428710837615922238027660532782335166155514936937577846667014571797190122711781278045024002638475878833939681796295069079881712169068692953824852983002347606845411417813911064856023654975422749723100761513187002405391051091381784372179142252858743209852495787803468370333781842144401713868812424998441861812927119853331538256732187042153063119774853521467095533462633661086466733229240987984925669110951614361860154890974024191350962304361219612816595051866602203071561368473236466 08689050142639139065150639081993788523183650598972991254044794434251667742996598118492331515552728832740283526884424087528112832899806259126736995462473415433335001472314306127503903073971352520693381738433229507010490618675394331307847980156551303847581556852362180104196502555961819349863159132330360964619059902361126811960234418433633345949276319461017166529138237171823942992162725384617760656945422978770713831988170369645886898118632109769003557358846244648357062914530527571012788720279653644 79724025405448132748391794128826423835171949197209797145936887537198729130831738033911016128547415377377715951728084111627597186384924222802373441925469991983672192131287035585307966942713416391033882754318613643490100943197409047331014476299861725424423355612237435715825933382804986243892498222780715951762757847109475119033482241412025182688713728193104253478196128440176479531505057110722974314569915223451643121848657575786528197564843508958384722923534559464521215831657751471298708225909292655 63883665112068194383690411625266871004456024370420066370900194118555716047204464369693285006004692814050711906926139399390273553454556747031490388602202463994826050176243196930564066636662609020704888743889890749815286544438186291738290105182086993638266186830391527326458128678280660133750009659336462514609172318031293034787742123467911845479131110989779464821692250562939995679348380169915743970053754213448587458685604728675106542334189383909911058646559511364606105515683854121745980180713316361 25730796111683438637676673073545834947897883163301292408008363568259391571131309780305164417166825183465736759341980849589479409832925000863897785634946932124734261030627137450772861569225966285738579055332406418490184513282846327092697538308673084091422476594744399733481308109863994173797896570106870267341619671965915995885378348229882701256058423655895396903064749655841479813109971575420432563957760704851008815782914082507777385597901291294073094627859445058594122731948127532251523248015034665 19048228961406646890305102510916237770448486230229488966711380555607956620732449373374027836767300203011615227008921843515652121379215748206859356920790214502277133099987729459596952817044582181956080965811702798062669891205061560742325686842271306295009864421853470810407128917646906550836129916694778023822502789667843489199409657361704586786242554006942516693979292624714524945408858422726153755260071904336329196375777502176005195800693847635789586878489536872122898557806826518192703632099480155 87445557517531273647142129553649408438558661520801211507907506855334448925869328385965301327204697069457154695935365857178889486233329246520273585318853337094845540333656535698817258252891805663548836374379334841184558016833182767683464629199560551347003914787680864032262961664156066750815371064672310846196424753749055374480531822600271021640098058449752602303564003808347205314994117296573678506642140084269649710324191918212121320693976914392336837470922826773870813223668008692470349158684099115 30983154120635661231875043054675369832308279664574176208065931772656858416818379661061449634325441117069417002226578173583512598210807691019610522292638797450490192543119006205619065774524161919131875339840493439768233102984658933183730158095925228292068208622303325852801192664963144413164427730032377922747123306964171499455322610354751456312906688543454268697884477429817774937101176146516241836166802548152963353084908499430067636548061029400946937506098455885580439704859144495844450799784970455 83550685408745163316464118083123079704389849190506587586425810738422420591191941674182490452700288263983057950057341711487031187142834184499153456702915280104485145176055306971441761368582384102787659324662689978418319620312262421177391477208004883578333569204533935953254564897028558589735505751235129536540502842081022785248776603574246366673148680279486052445782673626230852978265057114624846595914210278122788941448163994973881884622768244851622051817076722169863265701654316919742651230041757329 90447353767253684579275436541282655358185804684006936771860502007054724754840080553042495185449526724726134731817474218007857469346544713603697588411802940803961674694628854067917213860122541950381970453841726800639882065632879283958270851091995883944829777564715202613287108952616341770715164289948795356485455355314875497813400996485449863582484769059003311696130376612792346432312970662841130742704620203201336835038542536031363676357521260470742531120923340283748294945310472741896928727557202761 52722682833767413934256526532830684699975970977500055608899326850250492128840682741398816315404564903507758716800740556857240217586854390532281337707074158307562696283169556874240605277264858530506113563848519659189686495963355682169754376214307786659347304501648224329648912707098980766766256715172690620588155496663825738292741820822789606844882229833948166709840390242835143068137672534601260072692629694686727507943461904399966189796119287505194423564026443032717373415912814960561683539881885694 84045342311424613559925272330064881627466723523751234311893442118885085079358163848994487544756331689213869675574302737953785262542329024881047181939037220666894702204258836895840939998453560948869946833852579675161882159410981624918741813364726965123980677561947912557957446471427868624053750576104204267149366084980238274680575982591331006919941904651906531171908926077949119217946407355129633864523035673345588033313197080365457184791550432654899559705862888286866606618021882248602144999973122164 13817065348017551043840662441282280361664890425737764095632648282525840766904560843949032529052633753231650908768133661424239830953080654966187938194912003391948949406513239881664208008839555494223709673484007264270570116508907519615537018626479745638118785617545711340047381076276301495330973517418065547911266093803431137853253288353335202493436597912934128485497094682632907583019307266533778255931433111096384805394085928398890779621047984791968687653998747709591278872747587443980677982496827827 22009264499445593804146087706419418104407582698056880389496546165879839046605876453418102899071942930217745199761044950431968415034555140448209289333786573630528306199900777487269229986082790531716918765788609089418170579934048902184415597910926768627965975839524839267348836347456516870161662406424242412289611180106156823425393921800524834547237792199112285959141918774917938233400100781283265067102817813960291209147201009478787525512633728842223538694900679276645116347581011938753196572421214760 38284774774571704578610417385747911301908583877890152334343013005282797038580359815182929600305682612091950943737325454171056383887047528950563961029843641360935641632589408137981511693338619797339821670761004607980096016024823096943043806956620123213650140549586250615282588033022908385812478469315720323233601899469437647726721879376826431828382603564520699468630216048874528424363593558622333506235945002890558581611275341783750455936126130852640828051213873177490200249552738734585956405160830583 05377073253397155262044470542957353836111367752316997274029294167420442324811387507563131907827218886405337469421384216992886294047963530515056078812636620649723125757901959887304119562622734372890051656111109411174527796548279047125058199907749806382155937688554649882293898540829132512907647838632249478101675349169348928810420301561028338614382737816094634133538357834076531432141715065587754782025245478065730134227747061674424196895261316427410469547462148375628829977180418678508454696561915090 86958742511844358373065909514609804512474094113738999278224929833677960110153870961297497055663016373072027507347599229437923938244274211861582361613178863925530951171884212985083072382597291441422515794038830113590833316518582349672212596218125070581137594955250227472746743698871319266707692991990844671612287388584575846227265733307537355728239516169641751986750126817454293237382941438248143771398619067166575729458078048205595118816871880752129718326364421553367877512747669407901170575098195750 84563565217389544179875074523854455200133572033332379895074393905312918212255259833790909463630202185353848854825062897715616963860712382771725621313460549401770413581731931763370136332252819127547191443450920711848838366818174263342949611870091503049165339464763717766439120798347494627397822171502090670190302469762151278521956142070806461631373236517853976292092025500288962012970141379640038055734949269073535145961208674796547733692958773628635660143767964038430796864138563447801328261284589184 89852804804884418082163942397401436290348166545811445436646003249061876303950235640204453074821024136689519664422133920075747912868380517515063466256939193774028351207566626082989049187728783385217852279204577184696585527879044756219266399200840930207567392536373562839082981757790215320210640961737328359849406665214119818381088451545977289516457213189779790749194101314836854463961690460703010759681893374121757598816512700076126278916951040631585763753478742007022205107089125761236165802680681585 84998526314658780866168007332646768302063916972030648944056281954061906852420030534631566218913273090696873531816410945142880366059952202482488867115544291047219291342483464387053685086487490991788126705656653871910497218200423714927401644609434598453925367061322106165330856620211889682340057526754861014769936887382095845522115719234796868881608536316158628801503959494185294892270744108282071693033878180849362040182552222710109856534448172074707560192459155994310729495781978785905789400525401228 67517142511184356437184053563024181225473266093302710397968091064939272722683035410467632591355279683837705019855234621222858410557119921731717969804339317707750755627056047831779844447637560254637033369247114220815519973691371975163241302748712199863404548248524570118553342675264715978310731245663429805221455494156252724028915333354349341217862037007260315279870771872491234494477147909520734761385425485311552773301030342476835865496093722324007154518129732692081058424090557725645803681462234493 18970813889714329983134761779967971245378231070373915147387869211918756670031932128189680332269659445928621060743882741691946516226763254066507088107103039417886056489376981673415902592519461182364294565266937220315550470021359884629275801252771542201662995486313032491231102962792372389976641680349714122652793190763632613681414551637665655983978848938173308266877990196288693229659737995193162118721545528739417024366988559388879331674453336311954151840408828381519342123412282003095031334105070476 01599879854725291906652224793197154403317948368373732208218857733416238564413807005419135302459439135025545318864547962522602517629283743304651023610575835145507394433396102162296754614157811271970017386114942795014112532806212547758105129720884652631580948066336876701473107335407177108766159358568140982129677307591973829734414452566887708553245708889583209938234321027182241147637327913575686154212528496579033350931527769255058456440105521926445053120737562877449981636463328358161403301758139673 59427327690448920361880386754955751806890058532927201493923500525845146706982628548257883267398735220457228239290207144822219885587102896991935873074277815159757620764023951243860202032596596250212578349957710085626386118233813318509014686577064010676278617583772772895892746039403930337271873850536912957126715066896688493880885142943609962012966759079225082275313812849851526902931700263136328942095797577959327635531162066753488651317323872438748063513314512644889967589828812925480076425186586490 24111112730135719718138160258317850693224400799865663537154408845486639318170839573578079905973083909488180406093595919090747396090441015051632174968141210076571917748376735575100073361692238653742907945780320004233745280756615304292901449578062963413838355178359976470885134900485697369796523869584599459559209070905895689145114141268450546211794502661175016692826025095077077821195043261738322356243760177679936279609936897519139496503335850715541843645685261667424368892037103749532842592713161053 78349807407391586338179676584252580367372064693512486522384813416638080615057048290598906964519364400185971204257230073164100099169875242603773621777634306216167448849308109299010095179745415642512048220867145868492551324442667771278637282113315362243010918243912433802140462422233491535595168908162884879899882736304453724321742802157557779670216663170479697281724833928410156422745072717792693999297403080727703950135815451424940490265361058254093731146531049433824843797186069372144446008267980024 71229489405761853892203425608302697052876621377373594394224114707074072902725461307358541745691419446487624357682397065703184168467540733466346293673983620004041400714054277632480132742202685393698869787607009590048684650626771363070979821006557285101306601010780633743344773073478653881742681230743766066643312775356466578603715192922768440458273283243808212841218776132042460464900801054731426749260826922155637405486241717031027919996942645620955619816454547662045022411449404749349832206807191352 76798674781345820385957041346617793722853494003163159954409368408957253343870298671782977037333280680176463950209002394193149911500910527682111951099906316615031158558283558260717941005252858361136996130344279017381178741206128818206202326384986151565645123004779296756361834576810504334176954306753804111392855379252924134733948105053202570872818630729115891133594201476187266429156403637192760230628384065042544174233546454998705531872688792642410214736369862546374715974435494344389973005174252511 08773578863909468120966734281525859199248576404880550713298142993599114632399191139599267525763590074465728101918058418073422277347213977232182317717169164001088261125490933611867805757223910181861685491085008852722743742120865248523724562486976622453848192986711294529455154970305859193071984971054141816369689761311267440270096486675459345670599369954645005589216280479763656861333165639073957032720343891754152675009150111988568727088481955316769316812728921430313768180164454773675183534978579242 76463354162433601125960252109501612264110346083465648235597934274056868849224458745493776752120324703803035491157544831295275891939893680876327685438769557694881422844311998595700727521393176837831770339130423060958999137314684569010422095161967070506420256733873446115655276175992727151877660010238944760539789516945708802728736225121076224091810066700883474737605156285533943565843756271241244457651663064085939507947550920463932245202535463634444791755661725962187199279186575490857852950012840229 03506151493731010700944615101161371242376142672254173205595920278212932572594714641722497732131638184532655527960427054187149623658525245864893325414506264233788565146467060429856478196846159366328895429978072254226479040061601975197500746054515006029180663827149701611098795133663377137843441619405312144529185518013657555866761501937302969193207612000925506508158327550849934076879725236998702356793102680413674571895664143185267905471716996299036301554564509004480278905570196832831363071899769915 3166679208958768572290600915472919636381673596673959975710326015571920237348580521128117458610065152598883843114511894880552129145775699146577530041384717124577965048175856395072895337539755822087777506072339445587895905719156736

I don't know if it is right, but it took less than a second to compute (MacBook Pro, for comparison).
14 years ago
I guess "SCRIPTY" in this case means "doesn't protect you from writing bad code". You *can* do things in Ruby that Java simply won't allow; sometimes, this is good, and sometimes not. I like the freedom I get in Ruby to do great things, while simultaneously running the risk of shooting myself in the foot. Your mileage may vary. ;-)
14 years ago
I'm not sure what measures of popularity are the right measures these days, but RailsConf 2007 just opened registration a day ago and has already sold out half of its (approximately 1300) available seats. Last year there were 650 people for the first every RailsConf, and this year will be double that. That's a pretty good growth curve. Add that to the O'Reilly and PragmaticProgrammer press releases showing that Ruby and Rails represent the two fastest growing sectors in technical publishing, and you have a pretty impressive story for gaining popularity.

That being said, Ruby will not replace Java (at least not in the next 5 years). That's not what Matz wants for Ruby, and it definitely isn't what DHH wants for Rails. We're finding wide acceptance for Ruby inside Fortune 100 companies and fresh-faced internet startups and everything in between, so anecdotally, its doing fine.

But those doing Java should not be afraid -- its going to be here for a long time.
14 years ago
Java is not "THE" OO language, just "A" OO language. It has many predecessors in the space, some of which are more "pure" than others. It has successors, too. If "object orientation" were rated on a scale of 1 to 10, I'd put Java at around an 8, and Ruby at around a 9. Autoboxing/unboxing, while interesting, are compiler hacks to get around the fact that Java was built from the ground up with two main Types, Primitives and Object. And since Autoboxing/unboxing was only added in Java5, its a new feature that many developers aren't even taking advantage of yet.

(Anybody want to count how many parseFloat() calls are still laying around your code? ;-) )

Which is to say, Java took an approach to object orientation which far exceeded that of its direct progenitor, C++. C++, of course, was OO bolted on to C, and as such, suffered from complexity and lack of platform features to enable good OO. Java was an immense step forward, but that doesn't make it the "best" or even "only" example of a good OO language. Ruby is squarely in that camp (with some functional programming goodness mixed in), and some might argue that SmallTalk is a better OO language than either.
14 years ago
IMHO, you would choose Ruby or Java based on how much time and effort you would spend in that language on a project and the overall quality of the result you would expect for that investment. For certain applications, Ruby (and Rails) will let you work faster and end up with higher quality code. The same is true for Java.

Here's a short list of factors I would use to determine if the app was right for Ruby/Rails:

  • its a web app, like an ecommerce site or a social networking site, with a lot of custom ajax pieces
  • it doesn't need cross database transactions
  • it is going to have to change a lot both during production and after release due to changing requirements
  • I have a small dev team (say, four or less)
  • I have a certain amount of control, or at least input, on the database schema and the deployment environment

  • The first criteria (for type of web app) is not really a criteria as much as an indicator. We've done Ruby and Rails for lots of projects that weren't ecommerce or social networking apps, but if that's the gig, the rest of the criteria are less important.
    14 years ago
    You can also check out the PLEAC-Ruby site, which is a rewrite of the Perl cookbook in Ruby. Walks through most of the major scripting tasks you would normally perform, and you can compare them directly against their Perl counterparts for a direct comparison.
    14 years ago
    Mongrel is an incredible web server, and it does a remarkable job of serving a lot of Ruby code very robustly. If you truly need 10 million transactions a minute inside a single process, then you wouldn't want to use a standard Ruby process, no. But if you are doing anything reasonable, Rails *can* be fine.

    But I think the original post in this thread hits a sore spot for me. Don't confuse Ruby (the language), the Ruby interpreter (the platform), Rails (the framework), Java (the language) and Java (the platform). Ruby (the language) is a highly productive programming language, which has an amazingly tight frameowork in Rails, that can run on the Ruby interpreter or on the JVM (the Java platform).

    Java (the language) doesn't buy you massive multi-million-tx/sec scalability. The JVM does. In fact, I *might* argue that the language itself holds you back some.

    But if you can write a great app in Ruby using Rails and deploy it and scale it on the JVM, then what, really, is the problem? You can bet that this is part of the future Sun sees, because they brought the JRuby team in-house to help make it reality.

    However, as Lasse pointed out, not every tool is right for every job, and this is a point we make again and again, both in the book and in our public lives. Choose the tool that solves your problem; don't try to make your problem fit the tools.
    14 years ago

    1. When do you think that will be possible?



    Its already possible, with JRuby at least. Our open source framework (Streamlined) is a plugin on top of Rails, and even it runs on JRuby now. So it is already possible.

    2. Will the apps run pretty much unchanged?



    Replace "pretty much" with "entirely" and there you go. ;-)

    3. Why would you want to do that? a) Speed, b) integration with Java Libraries?
    4, 5, 6 ... Any other benefits?



    First and foremost, to leverage existing Java libraries and infrastructure. The two big ones are JMS and JTA, but there are other libraries you might want to tap into (somebody in another thread referenced JasperReports, for example). Secondly, to utilize the awesome management capabilities in Java5. The live monitoring of the JVM is great stuff.

    what is it in your opinion that differentiates your book from the rest?



    The book was written as a way to translate knowledge you already have into the new framework. So, instead of saying "Here's what an object-relational mapping framework is, and here is why it is useful, and here's how ActiveRecord works", we say "so, you already know how to map a one-to-many relationship in Hibernate, here's the ActiveRecord way". We skip a lot of the introductory materials in favor of helping the working Java professional get proficient right away.

    Also, I have questions around Security in Ruby. When will there be support for PKI, WS-Security etc? What is the RoR community position on that? What is your opinion? [/QUOTE]

    You can already take advantage of many pieces of PKI infrastructure through Ruby's excellent OpenSSL libraries, which gives you certificates, keystores, CA authorities, etc. With great integration to the CAS project through RubyCas you get Single Sign On, and the SOAP4R project is working toward WS-Security.

    Can someone experienced in J2EE and Web frameworks like Struts leverage his/her knowledge to fast track learning Ruby on Rails? Does your book help on that front? If yes, then please elaborate.


    Yes, and yes. We try to go through the core concepts of a Struts application and highlight what the equivalent ideas are in Rails.

    14 years ago
    So, let's say you have a class that's buried somewhere, like, Rails' ActionController. And you want to add a new method to it, like, "help" (so that all your controllers had a /your_controller/help url that tells what that controller is for).

    You can create a module to hold the new, shared method:


    Then, you can, from anywhere in the code, call:



    Voila. Your controller now has a "help" method.

    What if you wanted to wrap a method already in a class? For that, you would use .



    If you then extend that into a class with a "save" method, it renames the original method, creates a new method of the same name (a proxy, if you will), and when it is called, the new method logs the process and forwards the call to the original method.

    There is a new addition to Rails 1.2 called alias_method_chain which makes the whole process a little cleaner, as well.
    [ January 31, 2007: Message edited by: Justin Gehtland ]
    14 years ago
    Yes. Rails supports caching at several levesls:

    1) full page output. When templates are rendered, they can be stored in the /public folder automatically as HTML for future rendering. This can be scheduled to timeout at certain intervals using a filter.

    2) partial page output. The results of rendering partials can be cached for future inclusion into another template.

    3) action caching. The results of running a controller action can be cached for use in another template.

    I actually find the caching strategies in Rails easier to manage than in other web frameworks.

    The only caching that Rails does NOT support natively is object caching. ActiveRecord does not have a native second-level cache for the objects loaded from the database. You can use the optional acts_as_cached plugin, which uses memcached as its storage device, which is localized second-level caching. As far as I know, there is no native, clustered second-level cache for data objects.
    14 years ago
    Most Java frameworks don't let you just override parts of the core, largely because you would have to inject those changes into the initial load. Frameworks built on DI, like many of the newer tools based on Spring, give you some of this by letting you determine the classes that make up the framework in an externalized descriptor file.

    With Ruby, though, at any time and in any context, you can re-open a core class (there isn't even any real notion of sealed or final classes) and modify its internals.
    14 years ago
    "Jimmy".to_i == 0

    This might be one of those "paradigm shifts" asked about earlier. ;-)

    There's two ways you can go with an attempt to convert a non-numeric string into an integer: you can throw an exception, or you can return an innocous, documented, well-known answer. Java very often goes with the former approach; trying to parse a string into an integer when it can't results in an exception. Ruby very often takes the latter approach; you asked for an integer, and you passed me something with no number in it, so we'll just give you 0.

    Likewise, functions that are supposed to return collections of things rarely throw exceptions because of simple type conflicts; they just return empty arrays. In both cases, my code can be quite succinct because I always get back what I expect.

    However, it is perfectly reasonable to prefer the former approach. It just isn't crazy to like the latter, either. ;-)
    14 years ago
    I like Ruby for a few reasons.

    First, its openness. I like the fact that I can extend, modify or wholly replace pieces of the core language or the frameworks I use without modifying the original source code. This means I can have context-specific modifications to core components, which lets me easily target my domain problem with the sharpest tools I can.

    Second, its conciseness. I can *often* express more complex behavior in fewer abstractions, which means that there is less code to maintain and fewer places where things can go wrong.

    Third, the language itself is easily shaped into new languages. This is the DSL rage going on right now, and it is pretty powerful. You can do DSLs in other languages, but Ruby and its metaprogramming features seem to make it easier.

    As far as Rails goes, well, first and foremost, its an integrated framework stack. From the database to the view layer, it has what I want. I don't have to worry too much about what library I'm going to use for what task. Its conventions mean I can spend more time writing code to do stuff rather than tie stuff together. The development story is great, with an integrated server and lack of compile-deploy-run cycle.

    For more details, obviously I'd recommend the book, but the book isn't about convincing anybody to switch. There are lots of books about that. Our theory is that there is plenty of room for Ruby/Rails and Java/J2EE. So much room, in fact, that a lot of programmers are going to have to know both. If you already know Java/J2EE, this book helps you map what you know onto Ruby/Rails.
    14 years ago
    I'd say the biggest barricade to pouring that effort into Java is the glacial pace of change of Java, due to the processes surrounding modifications to the core language and libraries. Which isn't to say it won't change, or good work isn't being done. Far from it. But for speed of change, a smaller, totally open source project is going to win every time.

    What I find so appealing is that the Java community is rallying and finding out how to adopt many of the features of Ruby and Rails that make it compelling. JRuby, SEAM, Sails, Tapestry, and many other projects are racing to learn the lessons and take what can be taken.
    14 years ago
    Sorry, got carried away. ;-)

    Shift 1: Convention over Configuration. Learning to let go of massive URL-mapping patterns and declarations pointing classes at tables, etc. This is actually emotionally difficult for some folks.

    Shift 2: Ability to modify the framework without re-writing the source. I "monkey-patch" Rails (and Ruby) on almost every project. I never do it by opening up the source code, but rather by mixing my changes into the framework (or language) at runtime. This is an enormously powerful shift that people tend to ignore at the beginning.

    Shift 3: Testing, not debugging. I know of almost no Ruby/Rails programmers who use the debugger. Dave Thomas has famously said that he has NEVER used the debugger. Testing is where its at, baby.
    14 years ago