What Go and Scala has in Common and why Static is surging

Source: Internet
Author: User
Tags hadoop mapreduce
This is a creation in Article, where the information may have evolved or changed.

What does the Go (the language) and Scala (an object-functional programming and scripting language) has in common? They is both growing in popularity. They is both strongly typed languages. And, they is capturing mindshare from dynamic language experts.

At OSCON this week I attended the "Getting Started with scalding, Twitter's high-level Scala API for Hadoop MapReduce" by Avi Bryant of Stripe. Conference veterans might remember Avi from he keynote at RailsConf in 2007. Avi talked about Smalltalk and Ruby, the decidely "dynamic" languages, where dynamic means no typing; Everything is just a object, or at least, the interpreter does isn't tell you, your data does not fit your functions UN Til after it has started running.

Another-thinking about typing-to-look in the other language case:those, is statically typed. The data inside the programs written in a static language are data constrained by a type. Imagine types to is like classifications. Without classifications in the real world, you could stick a duck into a beehive. It makes it easier to do beehives and easier to store ducks, but do might find the honey tastes strange once in a while . Dynamic languages enable people to ship things quickly. Twitter started using Ruby and bootstrapped fast; But now we had Avi talking about scalding during he time at Twitter. Twitter has moved much of IT architecture (an architecture which now needs to being stability and not rapid iteration) to St Atic languages.

Why is static languages surging in popularity? As Avi noted in its talk today, the static languages spout error messages at compile time, rather than run time. When we were building the first versions of Web apps, our Write/compile/run phase is small:we might make a change, hit t He server and see the results in we browser in a few seconds. The feedback loop was small. Avi's talk today is about Hadoop clusters computing millions of records of data. As Avi noted, a "job" might take ten hours, and your want to see your programming errors during compile time (before the JO B have been submitted to Hadoop) rather than during the running job. Static languages don ' t allow completion of the compile phase and don ' t allow your to submit a job until you have written co De which the compiler has verified uses the correct inputs and outputs. In other words, when you transform millions of records to something newsworthy about duck and bee relations, the compile R knows if the record should be a row ofBees or a row of ducks, and if the function is "Countducks" the compiler won ' t let you proceed unless the row your is putt ing into it comes from a duck factory. With Ruby or Smalltalk this can ' t Happen:these languages figure out whether it was a bee or duck after the job had started ("Hey, don ' t yell at me, they both has wings!"), and with a Hadoop job that moment might is five hours into the job, mea Ning you just wasted five hours.

So, static languages catch bugs earlier. As more and more work moves to large data set calculation, we'll see more reliance on these languages. Ironically, as our computing power grows, so has our data sets and log files. Processing the sheer volume of data have resulted in long running jobs, harkening back to the term job which used to be ref erring to "punchcard jobs" as we saw at the advent of computing. We ' ve largely forgotten the techniques of programming long running jobs. Static languages provide an entry-to-writing reliable long running processes. But they alos rids us of the tiresome memory management issues that plagued earlier static languages like C.

One last thing these and languages Excel At:concurrency. In he talk Avi showed code to process "Alice in Wonderland".

.filter{word = word.length > 2}
. Filternot{word = Word.isempty}
. Filter{word = Word.head.isUpper}
. Map{word = (Word, 1)}
. group
. Sum
. GroupAll
. maxby{Case ( Word,count) = = count}

This code was special because Scala and scalding can optimize it depending on whether it's running locally (on your laptop ) or over a cluster like Hadoop. But, Remember:this code does not need modification regardless of where it runs. You simply specify a different switch on the command line (–local Vs–hdfs); This is a safer-to-do transformation and transposing, by letting an optimizing compiler figure out how to translate a Job onto a running compute engine. Both Go and Scala provide language level concurrency constructs that is incredible easy to use compared to Java's Threadi ng or in node. js Async Callbacks (even when using promise based libraries). Concurrency is necessary for the distributed computing we see more and more. These languages provide a simple and safe a-to-do concurrency and this is another reason they is surging in popularity. When you want-to-take activity in a swarm, like bees or ants does, you build using simple components and simple workers. Bees is theA-go, not ducks. Use the right languages like Go and Scala.

Feature image via Flickr Creative Commons

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.