Ruby¸ßÊÖµãÆÀScala±à³ÌÓïÑÔ
<תÔØ>
¡ôScala µÄÈ·ºÜ°ô¡£
¡ôÎÒµÄÈ·ÈÏΪ¼ÆËã»úѧԺӦ¸Ã¿ªÒ»ÃÅ Scala µÄÓïÑԿγ̡£
ÔÚÕâƪÎÄÕÂÖУ¬ÎһὲÊöΪʲôÎÒ»áÓÐÕâÑùµÄÏë·¨£¬ÔÚ´Ë֮ǰ£¬Óм¸µãÎÒÏëÒªÏÈÉùÃ÷һϣº
±¾ÎÄÎÞÒâ¶Ô±à³ÌÓïÑÔ½øÐÐÆÀ±È£¬ÎÒÒª½²ÊöµÄÖ÷ÌåÊÇΪʲôÄãÓ¦¸Ãѧϰ Scala¡£51CTO֮ǰÔø·¢²¼¹ýһƪ Java ³ÌÐòԱΪºÎҪѧϰScalaµÄÎÄÕ£¬¿ÉÄÜÒ²»á¶ÔÄãÓÐËù°ïÖú¡£
Ä¿Ç° Scala ÓÐÁ½¸öʵÏÖ·½Ê½£¬Ò»ÖÖÊÇÔÚ JVM£¨Java ÐéÄâ»ú£©ÉÏÔËÐУ¬ÁíÒ»ÖÖÊÇÔÚ CLR£¨Common Language Runtime µÄËõд£¬¼´¹«¹²ÓïÑÔÔËÐп⣩ÉÏÔËÐС£²»¹ý£¬JVM µÄʵÏÖ·½Ê½¸üΪ³ÉÊì¡£Èç¹ûÄãÏëҪʹÓà .Net framework ¿ò¼Ü£¬ÎÒÈÏΪ×îºÃ»¹ÊÇÌý´Ó Lift framework ¿ò¼Ü´´Ê¼ÈË´óÎÀ²¨À¿Ë£¨David Pollack£©µÄ½¨Ò飺ʹÓà F#¡£µ«ÔÚÕâƪÎÄÕÂÖУ¬ÎÒ½«Ö»¹Ø×¢ JVM ÕâÖÖʵÏÖ·½Ê½¡£
ÎÒÊÇÒ»¸ö Ruby ³ÌÐòÔ±£¬²¢ÇÒÎÒ»á¼ÌÐøϲ»¶ Ruby£¬ÒòΪËüÊÇÎÒ¼ûµ½¹ýµÄ×î°ôµÄ¶¯Ì¬ÓïÑÔ¡£µ«ÎÒҲϲ»¶ Scala£¬ÒòΪÔÚÆäËû¹¤×÷ÁìÓò£¬ËüÌṩµÄijЩ¹¦Äܷdz£Ç¿´ó¡£
ÏÖÔÚ£¬ÈÃÎÒÃÇÀ´×Ðϸ·ÖÎöһϣ¬ÊÇÄÄЩÔÒòÈÃÎÒÑ¡Ôñ Scala ×÷ΪÎÒµÄÏÂÒ»¸ö±à³ÌÓïÑÔ£º
Ç¿´óµÄ±à³ÌÓïÑÔ
Scala ÊÇÒ»Ãŷdz£Ç¿´óµÄÓïÑÔ£¬ËüÔÊÐíÓû§Ê¹ÓÃÃüÁîºÍº¯Êý·¶Ê½½øÐбàд´úÂ룬Òò´Ë£¬±à³ÌʱÄã¿ÉÒÔʹÓó£ÓõÄÃüÁîʽÓï¾ä£¬¾ÍÏñÎÒÃÇʹÓà C¡¢Java¡¢PHP ÒÔ¼°ºÜ¶àÆäËûÓïÑÔÒ»Ñù£¬¶øÇÒ£¬ÄãÒ²¿ÉÒÔʹÓÃÀàËÆ Lisp ÓïÑÔÖк¯ÊýʽÓï¾ä£¬»¹ÓУ¬Äã¿ÉÒÔ»ìºÏʹÓÃÕâÁ½ÖÖ·ç¸ñµÄÓï¾ä£¬¾ÍÏñ Ruby »ò Groovy¡£
²»¹ý£¬µ±ÎÒÃÇ̸Â۵ĺ¯Êý·¶Ê½Ê±£¬Óë Ruby ºÍ Groovy ÓÐÒ»µã²»Í¬µÄµØ·½£¬ÄǾÍÊÇ Scala ¼¸ºõÖ§³Öº¯ÊýÓïÑÔÖÐËùÓÐÒÑÖªµÄ¹¦ÄÜ£¬±ÈÈ磬ģʽƥÅ䣨Pattern matching£©¡¢ÑÓ³Ù³õʼ»¯£¨Lazy initialization£©¡¢Æ«º¯Êý£¨Partial Function£©¡¢²»±äÐÔ£¨Immutability£©£¬µÈµÈ...¼´ÊÇ˵£¬ÈÏʶµ½ÕâÑùÒ»¸öÊÂʵÊǷdz£ÖØÒªµÄ£ºScala µÄÇ¿´óÔ´×ÔËü¶Ôº¯Êý·¶Ê½µÄÖ§³Ö£¬¶øºóÕßÁî Scala ³ÉΪһÖָߵȼ¶£¨high-level£©µÄ±à³ÌÓïÑÔ¡£¶ÔÓڸߵȼ¶µÄ±à³ÌÓïÑÔ£¬ÄãÖ»Ðè¹Ø×¢ what£¨×öʲô£©¶ø²»ÊÇÈçºÎ×ö£¨how£©¡£
ÏÂÃ棬ÈÃÎÒÃÇ¿´Ò»¸ö Java ʾÀý£º
int[] x = {1,2,3,4,5,6}; ArrayList res = new ArrayList(); for (int v : x) { if (v % 2 == 1) res.add(new Integer(v)); }
×Ðϸ¿´Ò»ÏÂÉÏÃæÕâ¶ÎʾÀý´úÂ룬Äã»á×¢Òâµ½£¬ÎÒÏëÒª×öµÄ“what”²¿·Ö£¨¹ýÂ˵ôÆæÊýÖµ£©½ö³öÏÖÔÚµÚËÄÐÐÖУ¬¶øÆäÓàÐÐÔòÊÇ“how”ÈçºÎ×öµÄ²¿·Ö£¨½á¹û±äÁ¿µÄ³õʼ»¯ÒÔ¼°Ò»¸öÑ»·²Ù×÷£©¡£Èç¹ûÎÒÏëÒªÔÙдһ¸ö¹ýÂËÆ÷£¬ÓÃÓÚɸѡżÊýÖµ£¬ÄǾÍÐèÒªÔÙдÎåÐдú
Ïà¹ØÎĵµ£º
Watir Óï·¨£¨Web Application Testing in Ruby)
# watirµÄ°²×°
watieµÄ°²×°Çë²é¿´ -> Ruby libraryµÄ°²×°
# ʹÓÃWatir¹¤¾ß£¬ÐèÒªÔڽű¾ÖмÓÉÏ
require 'watir'
# ´´½¨Ò»¸öIEµÄʵÀý
ie = Watir::IE.new
»òÕßÔÚ´´½¨µÄͬʱֱ½Óתµ½Ò³Ãæ
ie = Watir::IE.start('http://www.text.com/')
WatirʹÓÃstart·½·¨ ......
Bignum
+ ¼Ó
- ¼õ
* ³Ë
/ ³ý
** Ö¸Êý²Ù×÷2**2 Òâ˼ÊÇ2µÄƽ·½
<=> ´óÓÚ, ......
¿ª·¢»·¾³
OS:WindowsXP
Ruby:Ruby1.8.7
Rails:Rails2.3.5
Mysql:Mysql5.0.9
IDE:Rubymine2.0.1
×¼±¸¹¤×÷£º
°²×°ÒÔÏÂgem°ü
gem install ruport
gem install ruport-util
gem install acts_as_reportable
±¾ÀýÉè¼ÆµÄ±¨±íϵͳ¹¤×÷ÔÀíÈçͼ£¨´¿Êô¸öÈËÀí½â£©£¬ÒÔProducts±íΪÀý£º
½ÓÏÂÀ´ÊµÏÖµÄÀý×Ó½«ÀûÓÃeval·½·¨ÊµÏ ......
FPDFÄÜÖ§³ÖPDFµÄÖÐÎÄ´òÓ¡£¬È»¶øÈ´´æÔÚ²»ÉٵIJ»ÈçÒâÖ®´¦£¬¾ÝÎÒÄ¿Ç°µÄʹÓã¬×ܽá³ö¼¸µã£º
1£©FPDFÌṩµÄPdf_Chinese×ÖÌ壬½«GBÕâÖÖ×ÖÌåдÈëÁË´úÂëÖУ¬ÈôÎÒÃÇÏ£ÍûÒýÈëÆäËûµÄÖÐÎÄ×ÖÌ壬Ôò²»ÄÜ·½±ãµØʹÓÃ
2£©FPDFÊä³öµÄÊý×Ö²¢²»ÃÀ¹Û£¬²»ÈçRuport::Formatter::PDF×Ô´øµÄ×ÖÌå
3£©FPDFÌṩµÄ·½·¨²¢²»¶à£¬¶ÔÓÚÒ»°ãµÄ±¨±í´òÓ¡£¬Óõ ......
ת×Ô51testing.com, Ô¼û£ºhttp://bbs.51testing.com/thread-171535-1-1.html http://swik.net/Watir+Programming
http://www.pragprog.com/ #ºÜ¶àºÃµÄÔ´ÂëŶ
http://docs.rubygems.org/ #rubygems
http://www.fxruby.org/ #fxruby
http://groups.google.com/group/watir-general/topics #goog ......