Scala, a Statically Typed, Functional, O-O Language
inkslinger77 notes a Computerworld interview with Martin Odersky on the Scala language, which is getting a lot of attention from its use on high-profile sites such as Twitter and LinkedIn. The strongly typed language is intended to be a usable melding of functional and object-oriented programming techniques. "My co-workers and I spend a lot of time writing code so we wanted to have something that was a joy to program in. That was a very definite goal. We wanted to remove as many of the incantations of traditional high-protocol languages as possible and give Scala great expressiveness so that developers can model things in the ways they want to. ... You can express Scala programs in several ways. You can make them look very much like Java programs which is nice for programmers who start out coming from Java. ... But you can also express Scala programs in a purely functional way and those programs can end up looking quite different from typical Java programs. Often they are much more concise. ... Twitter has been able to sustain phenomenal growth, and it seems with more stability than what they had before the switch, so I think that's a good testament to Scala. ... [W]e are looking at new ways to program multicore processors and other parallel systems. We already have a head start here because Scala has a popular actor system which gives you a high-level way to express concurrency. ... The interesting thing is that actors in Scala are not a language feature, they have been done purely as a Scala library. So they are a good witness to Scala's flexibility..."
Scala Programmers: $35K - $45K
Our company is looking for motivated individuals with 5 + years in depth experience with Scala.
Must be familiar with all aspects of O-O Languages.
We are an equal opportunity employer.
When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
Same difference. You say potato, I say you're an asshole.
Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
Scala is great, but one really annoying thing about it is that it inherits type erasure implementation of generics from Java. This means that you cannot overload methods on argument with the same generic class with different type parameters, cannot implement the same generic interface with different type parameters on the same class, cannot check whether a class implements a particular generic interface for a given type parameter, etc. They did fix some issues - for example, you can instantiate arrays - but it's still far from perfect.
I understand the need to match Java's broken model for the sake of interoperability, but surely a better way can be devised for pure Scala code? It's pretty much the only area where Scala noticeably lags behind advanced .NET-hosted languages (such as Nemerle or F#).
Like mod_perl ?
To be fair, FailWhale has not been seen by me of late, and the Twitter devs attribute their salvation to Scala. However, there are some pretty good arguments that the Twitter developers Mother of All Fail was initially trying to write their own hand-rolled message queue instead of simply using one off-the-shelf.
Don't blame me, I voted for Baltar.
Strongly typed languages usually make type conversions explicit and enforce type restrictions; whereas weakly typed languages usually allow implicit type conversions and relax type restrictions.
Explicit type conversions disallow a value of type T to be treated as a value of type S without invoking a function that takes a value of type T and returns a corresponding value of type S. For example, a conversion from an integer type to a floating point type requires the invocation of a function that performs the conversion. Contrast this with implicit type conversions where a value can be treated as almost any type depending on how it is to be used.
Type restrictions only allow certain operations to be done to certain types. For example, numerical addition mïay only be performed on numerical types. A lack of type restrictions allow for numerical addition to apply for, say, booleans, for example.
No, this is Scala, a language that is a blend of functional and object oriented programming. Scalia is mix of textualism and originalism with a very conservative framework. Some consider its inability to recuse itself to be its greatest asset.
- None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
Ah - duh. Immediately started thinking typed, as in the clicky clicky kind of typing done on a keyboard.
Man, was that a loud and smelly brain fart.
Thanks for that.
Sorry. Sorry Everyone!
Shameless plug alert: Game server control panel
Probably the most robust JVM compatible language to date. Even the creater of Groovy digs Scala: http://macstrac.blogspot.com/2009/04/scala-as-long-term-replacement-for.html
Martin Odersky is beardless, Scala is doomed.
crazy dynamite monkey
Am I the only one not terribly enamored with Scala? It's a massive language (have you seen the book?), but a lot of the syntax is somewhat redundant and doesn't seem to add that much. The type system is downright byzantine, and the Java interface is, let's say, somewhat inelegant. And the whole object-functional thing seems like a paradigm in search of an audience (maybe I'm just not getting it).
And you get to pay for all this with a huge performance hit.
I guess their "more is more" approach is mostly making Clojure look more attractive.
sic transit gloria mundi
A very high volume of triviality is non-trivial.
I could use an alternative programming language for the JVM that is more expressive than Java. Both Scala and Groovy integrate well with Java at the language level, albeit with different type systems. While I do use Groovy from time to time, what kept me from Scala was that it is not well supported by IDEs (Eclipse/Netbeans - I hear things are somewhat better with IntelliJ). The problem is the nature of Java libraries. They tend to be deeply nested and often expressed in lower level abstractions and are difficult to use without strong IDE support. I don't need an IDE for Python (flat module systems, high level libraries), but certainly do for Java. With solid IDE support however, I am nearly as productive in Eclipse + Java as with dynamic languages, even for medium apps. Scala and Groovy come with their own standard libraries and I don't need IDE support as long as I stay within them. But sooner or later, I will need to step into plain Java land and I no longer feel productive. I would rather use straight Java for them.
The development experience is language + tools, not just the language. While Scala can piggy back on JVM and undercut the rest of the process that languages need to go through to mature and be accepted, Scala plugin (or someone else) has to provide a JDT equivalent first to have popular appeal.
I just wish there was a well supported superset of Java with productivity considerations that maintains 1:1 byte-code compatibility on compilation. Java purists can keep their language clean. But the rest of us can be happy too. Scala has that potential.... almost. So far, Groovy has been filling that role for me. Groovy will never have the kind of edit-time IDE intelligence simply due to it's dynamic nature. But for now, it stands ahead (after all, it has been around longer).
already has C-like syntax
Why not use the C instead then, or even better C++. After all many top websites run C++ (Google,eBay,Yahoo) as it is the fastest, well memory utilizing, best threading performance and green/CPU saving solution. With the native processor exceptions used properly it is also the most robust solution.
Most languages are strongly typed so that's not a particularly useful metric.
Hardly. The One True Language for client-side web development, aka Javascript, is weakly typed, as is PHP, that ubiquitous server-side programming language. Perl is weakly typed. Good ol' shell script is weakly typed. Heck, even C is considered weakly typed (unless you enable -Werror, of course).
Recently I decided to move from contracting to full time work as the job market is balls here in the Bay currently for Contracts. Twitter was one of the companies which I applied and I had the pleasure of having a "phone screen" with them for a senior unix position. Here's what this screen was, a basic unix question, that any lunix user could get. A more intermediate type question that could trick some people. And finally their *BIG SCREEN* a tricky question that was based on esoteric knowledge that had absolutely nothing to do with one's ability to perform the job.
The person calling me was just reading these off a list, she didn't know why they were picked and was only able to write down the answers. Here's the hilarious part, I informed her that the question was silly and there's no reason anyone should really care about this sort of information except in extreme situations. That this was the question that lead me to believe they had a culture of primadonnas. She diligently wrote all this down, in case they still wanted to talk to me.
But here's the REAL kicker, their stupid asinine esoteric question? Was wrong. They had the phrasing wrong... what they were asking and looking for in an answer were not the same things. Being a pedantic asshole, in my followup to tell them what I thought of their process I pointed this out. Never heard anything back ;) Wonder if they have fixed their question yet?
--- I do not moderate.
I have not only seen the book but also read it (assuming you mean Programming in Scala). It is very well written and gets you started with Scala easily.
I do not agree that the syntax is redundant. To the contrary: an important part of the language design is that Scala enables the programmer to extend the language using libraries. A good example is the way collections and iteration work in Scala vs. the way the foreach loop has been added in Java 5.
Whether static type systems help or hinder depends on whether you work with or agaist it, and on the kind of programs you write. The Scala type system is rather advanced (in the sense of complete) such that it allows you to express more in the type system than other languages do.
For Java style programming Scala is just much simpler and shorter to write. When you have written some code in both you can appreciate the way Scala works.
There has already been a comment on multi-paradigm programming, I do not have to extend that.
Those supposedly cute features are there for a reason--they make abnormally clean and maintainable code possible.
The best Scala code I've seen is clearer (to an outside observer) than the best Java code could possibly be, since the language features allow you to focus more on what is going on rather than necessary theatrics.
The worst Scala code is, admittedly, worse than the worst Java code could possibly be.
So, if I had programmers who wrote nice clean code, I'd encourage them to use Scala. If I had programmers who wrote ugly tangled code, I'd force them to use Java.
"C++ for everything. All the other languages start off with it after all."
Examples: Fortran, Lisp, C.....
Adherence to the truth is a form of disloyalty.
Strong typing helps _only_ weak programmers, the rest of us either (a) remember the types of our variables or (b) expect "1" + "2" -> 3, not "12".
As a programmer with 25 years of experience, I could hardly disagree more. When developing any large project, static typing is hugely beneficial. It lets you catch far, far more errors at compile time. In a dynamic language, those would all be runtime errors that could easily slip through your testing and make it out to a customer. It makes automated refactoring possible. (Ever try doing a major restructuring of a 500k line code base written in a dynamic language? Good luck!) It enables all sorts of static analyses that let you be a more productive programmer. Try using a really good Java IDE like Intellij IDEA, then try the best Python or Ruby editor available, and you'll feel like you've gone back to the stone age. No "Find Usages"? No autocompletion? No "Go to Definition"? You simply can't do these things in a dynamic language, because the editor has no idea what the type of any variable is.
This isn't meant to criticize dynamic languages. They definitely have their place. But 90% of the symbols in most programs should be statically typed. I don't see why more languages don't simply offer both options. In those that do (e.g. Groovy), type declarations are simply optional. If you declare a type, it gets checked at compile time. If you don't, that symbol becomes dynamically typed. It works very well.
"I'm too busy to research this and form an educated opinion, but I do have time to tell everyone my uninformed opinion."
That "why i hate" is a terrible editorial. What he is saying is that he doesn't want to think carefully about what he's doing. His objection isn't to languages really it is to clarity of thought. Tinkering and right brain is great for art, it isn't the right mode for engineering.
LISP, Perl and OCaml are far more useful than C++, Java and C#
Let's see:
I'm not sure what point you're trying to make, but it doesn't seem to have anything to do with either strong typing or static typing.
The academic idiots,
That's as opposed to the non-academic idiots, who apparently don't even know what "strong typing" means.
I don't mean to sound pedantic, or borish, but C is actually "yeah baby yeah" typed, to enable pointer arithmetic, stack space exhaustion, buffer overflows, and system level development. It's not incorrect to say that it is weakly typed, per se. It's just awkward having to try to explain the direct parallels between the C type system and a 70s style love-in (where anything goes) -- to your manager.
You are where you are at the time you are there.
So who do you think will be writing the "components" for your magic system, and the infrastructure to make the system executable, designable, testable and usable? We have been progressing to increasingly high level code (and in some cases, as you say, component architectures), but the amount of code being written and maintained continues to grow, not shrink.
So the amount of code is growing, and it does more per unit mass, and software engineering skills are increasingly valuable and applicable, and you think this is a trend towards the elimination of code and software engineers? You may want to check your water and food sources for contamination.
Sam ty sig.
I'm not too worried. The idea behind COBOL was that once you got rid of that mathy way of writing code anyone could do it. The fact is that taking a process and breaking it into a series of steps and dealing with all the cases takes practice. The problem is not syntax or language structure the problem is thinking through a problem that way.
Until computers have common sense all languages are going have to look like
Do X ...
Read Y
Y Case 1
Y Case 2...
Y Case 3....