Domain: scala-lang.org
Stories and comments across the archive that link to scala-lang.org.
Comments · 77
-
Re:I'm curious
It's possible to use Scala for Android development: http://www.scala-lang.org/node/160
Try it, you'll like it!
-
Re:Should have used PHP.
Scala also keeps Java's strong static typing and adds functional language features. I don't think it needs any development at all to be adapted for mainstream use.
Scala is a great thing, now what it needs is equally great tooling (i.e. IDE support, including refactoring, on the same level as we have for Java). And it's getting there - there is an Eclipse plugin, and a NetBeans one - but it definitely needs more work and polish.
The payoff would be huge, though. Right now, as far as languages go, C# is far more advanced than Java. But Scala is equally more advanced than C# (the only thing on
.NET that could compare with Scala is F#, and that's less stable and mature currently... but it will stabilize once VS2010 is released, so there isn't much time). Some significant investment into Scala by one of the big players could help straighten things out a bit (it's good when there are two major competing languages in the same niche, because it forces them to evolve at a more rapid pace, steal each other's features, and learn from each other's mistakes - as Java and C# did for several years, until Java began to stagnate).About the only thing I don't like about Scala is generic type erasure it inherited from Java to maintain class compatibility; but there are workarounds already, and if Scala becomes The Next Language for the Java platform, it may well deprecate erasure and introduce its own reified generics then.
Now, if only someone would pick it up and throw money (and marketing resources) at it. Like, say, Google...
-
Re:Wouldn't help
If you use a sane class for references that could possibly be null (like Option (aka Maybe in haskell) then your compiler will *force* you to handle the null case.
This is where null went wrong, at least in statically typed languages: it's a hole in the type system that errors fall through into your program. When coding in Java, I make an explicit point to never return null from a method; if I have a situation where no reasonable return value might exist, I use the Option class from functionaljava.org and thus force the client to handle the possibility of the method not returning sensible data. Since Option obeys the monad laws, it's easy to chain together multiple things that might fail (with the bind or flatMap operations.)
-
Scala
Time to look at Scala on the JVM: classes written in the Scala-language runs almost as fast as ones written in the Java language. Also Scala looks a lot like the Java language. http://www.scala-lang.org/
-
Re:Don't write off the Java *platform*
I second this post. The Java platform has tons of tools, amenities, and libraries. All you need is a decent language: take your pick! Java the language is now the C of the Java world: it's the lowest common denominator, the systems programming language, and the application language of choice for conservative no-nonsense types.
Scala is the C++ of Java-land: a sophisticated multiparadigm programming language that does everything Java does and more. On the other hand when you compare Scala against C++'s weaknesses, Scala is the anti-C++: terseness through type inference, excellent support for functional programming, small and clean language core, and able to be described in a twenty-page white paper. Suck that, C++!
-
Re:it's always a good time to try functional
If your OO experience is in Java then I would suggest you take a look at Scala. It compiles to the JVM and has good support for functional programming, but also supports your familiar OO techniques and interoperates with the huge amount of java code out there.
I'd still suggest you play with Haskell (probably the most pure functional language that's widely available) while you learn; it's fun and will really make you think about programming problems differently -- even if you never produce a line of production code using it.
-
Re:An brief introduction to functional programming
OK, so why is it so hard to create a hybrid language?
It's not hard, and there are plenty of them:
From the list above, OCaml is presently production-quality, and used rather widely. It also has a good performance profile, rivalring C/C++ with carefully written code. Of the others, the fastest-growing seems to be F# (mostly because Microsoft announced that they're making it into "Visual F#" and likely including it into Visual Studio 2010 alongside C# and VB as the third out-of-the-box
.NET development language). Scala has a pretty large following in the Java land, so much so that some call for freeze of Java language spec for the sake of stability, and moving onto Scala for further language development.Also, most modern dynamic languages (Perl, Python, Ruby, JavaScript) have many functional traits, and so do quite a few mainstream static ones (C#, VB).
-
Re:Too constrained and academic
You also need to be able to interface.
Which is exactly why I find Scala to be interesting. Note: I haven't had time to learn or use it yet, but the design concept there is very interesting.
-
Generic Non-Crap List
Considering that Java has been (probably) the most used language for a while, you get a lot of crap. So, here's my "crap filter" list of what you should learn to really hop into the JVM ecosystem.
Books:
1. Effective Java, 2nd edition, by Josh Bloch
This covers most of the twists and turns of the basics that an experienced programmer would need. I wouldn't worry about getting a simpler book.
2. Java Concurrency in Practice
Understanding the JVM model of concurrency is important, and this is the only guide that had a pretty in-depth look into the subject. The Sun documentation absolutely sucks at covering concurrency.
APIs
1. Guice http://code.google.com/p/google-guice/
Dependency injection is the most recent thing that makes Java a very powerful language for building large appications. And Guice is by far the best implementation of DI. (Yeah, you could learn Spring, but I just don't care for it.)
2. Hibernate http://hibernate.org/
I hate Hibernate. But it basically set the standard for EJB3. If you know Hibernate, it's not a very hard road to learn all the other "enterprise" crap.
On the other hand, any substantial server-based solution probably uses a ORM solution like Hibernate.
3. Apache's Commons http://commons.apache.org/ and Jakarta http://jakarta.apache.org/
There is a ton of projects under the Jakarta umbrella these days. The first one to try out is the commons-lang libraries, which provide very easy to use toString. equals, and hashCode implementations that are 'good enough' 99% of the time. Why do you need those? Read Effective Java.
:)Interesting stuff:
1. Hadoop http://hadoop.apache.org/
Hadoop is an open-source implementation of Google's MapReduce idea.
2. Scala http://scala-lang.org/
Scala is my favorite "non-Java" JVM language by far. For me, the scala interpreter is how I learn APIs. In fact, most of my new code is in Scala, not Java.
3. Groovy, JRuby
Just some more used non-Java JVM languages. I've used JRuby a bit, but have moved on to Scala. It's still a significant project, however.
4. Web application frameworks: Wicket http://wicket.apache.org/ + Databinder http://databinder.net/
Wicket is the simplest page-based Web framework I've ever used. I just find it easier to navigate than Rails. If you really want an ORM-based solution, go for the Databinder extensions. Databinder will get you coding in a couple of minutes.
5. Restlet http://restlet.org/
We have several different clusters, and a bunch of machines that need to transfer data around. I learned how to set up a restlet server that was integrated with Guice in a couple of hours, and now, have a very easy means to script together many different servers.
-
Re:Glaring Omission: Groovy
I would also look at Scala. Shares Groovy's strength of transparent Java interoperability, but opts for a radical departure in language design and concepts (for the better, IMHO).
-
Re:.NET is standardized
Another one to look at is Scala. Learned from Java's mistakes and still manages basically seamless integration with Java, which is a huge win.
-
Re:Comparison of functional languages?
Can't point you to a comparison article, but one language you should consider is Scala. It compiles to the Java platform, and thus can interact almost transparently with existing Java code and libraries, and uses Erlang's concurrency model. It can do both functional and imperitive, object-oriented tasks. It's statically-typed, but with features I didn't think were possible outside a dynamic language, such as duck-typing (only compile-time checked!)
It's very powerful, but sometimes hard to figure out. Not my ideal language, but the closest I've found.
Official site:
http://www.scala-lang.org/The busy Java developer's guide to Scala:
http://www.ibm.com/developerworks/views/java/libraryview.jsp?search_by=scala+newardScala for Java refugees:
http://www.codecommit.com/blog/scala/roundup-scala-for-java-refugees -
Scala
People may also want to check out Scala at:
http://www.scala-lang.org/It also uses the Erlang style concurrency approach and runs on the JVM with class compatibility with other JVM languages, ie Java, Groovy, etc.
-
Some say Java's type system doesn't go far enough
...and languages like SML or Haskell have this rigour within their type systems. Supposedly Scala (which uses the JVM) also has a rigorous type system but there's a language complexity price. Folks programming in Java can get around those problems by using "Good Engineering Principles" (see the "Static Typing's Paper Tigers" section) and if the Java folks don't need to go the whole hog on their type system...
-
Re:Mono needs a similar testsuite.
I agree that Java is showing its age. C# has the advantage that is was designed several years after Java and learnt from its mistakes. Also, Java had a philosophy (for quite a while although it seems to be changing) that language changes should be made quite conservatively. However, there are some languages that run on a JVM that integrate perfectly with the Java API but have all the C# features you mention (and many more). I highly recommend looking both at JRuby and Scala.
-
Re:Mono needs a similar testsuite.
I'm pretty sure
You should read John Rose's blog for nice comparisons between .NET has Java beat in several areas. For example, generics. In Java generics are just syntactic sugar for casting everything from java.lang.Object to something else. Each cast is a runtime type check, which comes at a performance penalty that I don't believe is trivial. .NET actually generates unique code without that casting. .NET and the JVM. You give a perfect example of something that would cost .NET in performance, but that the JVM optimizes out at runtime (casts). Don't take my word for it. Put together a micro-benchmark and see for yourself. If you download a fast-debug build of the JVM, you can even see the machine code it generates for a particular method (-XX:+PrintOptoAssembly).APIs, maybe, I don't know, but language features, definitely not.
If you want a nicer language on the JVM, use Scala. -
1995 called, they want their article back!Sun Microsystems launched this idea around 13 years ago... Java applets.
Though Java-centric in nature, the JVM provides a secure sandboxed environment to host numerous languages including Ruby, Python, Lisp and even JavaScript. Throw in Groovy and Scala for home-grown alternatives.
Thanks to the efforts of IcedTea (principally funded by RedHat) and others, Java 6 will be fully GPL by the end of the year.
-
Scala is the next big thing
I think scala has the potential to be the next Java. It is very modern but still has a C like syntax. Scala programs can be much more terse and expressive than Java. Scala has closures, much more powerful static analysis, and so on. The strictness of the type checking makes most variable declarations redundant.
James Gosling is on record saying that scala would be a good replacement for Java.
It compiles down to the Java VM.
The next big thing will be powerful like python & ruby, but will be strongly typed. Programmers prefer strongly typed: it catches bugs at compilation time and it is easier to write IDE's for them with autocomplete and such. -
My listMy list wish-list of "languages to learn next" looks something like this, in no specific order:
Haskell
Ruby
Erlang
R
Prolog
Groovy
Scala
Lua
Lisp
Smalltalk
Scheme
Ocaml
Ruby and Erlang are the two I've spent the most time with so far. I like Ruby enough so far, that I've decided to write the initial
batch of install scripts for OpenQabal in Ruby.
Outside of that wish-list, I also harbor some vague hope of one day finding time to dabble with Forth, Fortran, Perl, and maybe Dylan. -
Scala is a multi-paradigm language
"Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages."
http://www.scala-lang.org/intro/index.html
Functional programming is just a part of it. You don't have to use it. Just like you don't have to use generics in java.
If you want to you can use it write something that just looks like cleaner java programs in Scala. That what makes it easy to learn.
I am sure that as soon as the tools get up to speed, we will start seeing people building great things with Scala. -
Re:Choose wisely
-
Tools != fetishesIt would be amazing if people actually read the article every once in a while.
:-/
I make a living as a Java programmer. I enjoy the work I do and feel that no other language/platform can even touch Java's capabilities in team and enterprise development. Even for single-programmer development, there are a lot of situations where Java is the solution to end all solutions.I have also made my living for the past ten years as a Java programmer. Before that I was a C programmer, and before that I was a LISP programmer. There's no doubt whatever in my mind that of those languages the most powerful, productive and expressive is LISP. However, there's equally no doubt in my mind that any high-level language is primarily a means to communicate with the programmer who has to maintain your code after you, and if it doesn't achieve that goal then it fails.
Many languages have strengths. Java was designed as a special purpose language for programming the low-power, processor and memory-poor devices. For everything else it is compromised by those design goals. But it has the great strength that it is now a lingua franca that many people in the industry can read and understand.
If you're fetishistic about your tools - if you believe that one particular language (normally the one you're familiar with) is somehow better than all others, then you are fundamentally a poor programmer. A good programmer can pick up any Turing complete language and produce good code - and, more importantly, can assess the strengths and the weaknesses of those languages. But in the end, any language is merely a tool, and every Turing-complete language can be used to achieve exactly the same results as any other Turing-complete language.
Me? The most interesting new language I've seen for a while is Scala.
That being said, I agree with the article.
As the author tried to explain, programmers need a solid foundation in data structures and algorithms before they should even begin looking at Java. The specific problem he calls out (which I actually feel only scratches the surface) is that Java offers such a featureful API that the programmer isn't forced to learn the basics. He is able to simply use a Hashtable, a Sort, a LinkedList, or whatever he needs without understanding why it works. Which is a very dangerous thing for someone training to be a Computer Scientist.
I, frankly, don't agree with the article. Firstly, Java has nothing to do with the case - it's a complete side issue. As a pedagogic language, Java has some merits; it's simple, reasonably orthogonal, and has very clear syntax for expressing structure. And it's just as easy to write a course using C++ which uses only very high level graphical toolkits as it is in Java. The issue isn't the language used for teaching (although I'd prefer to see students introduced to a range of languages); the issue is what is taught. A Java-based course, on the other hand, which takes the student through designing their own compiler in Java (not for Java) and then onto considerations of 'Just In Time' compilation will teach as much or more basic computer science as a course which teaches compiler design in C.
If you think you can stick with the programming technology you learned in college for the rest of your life then you're in the wrong industry, my son. The core skill of a programmer is learning new technologies, not rehashing things in familiar ones.
-
PHP!? Oh the humanity!...
Ah, the title seemed promising: someone had come to the conclusion that there is a world outside of the Rails hype-machine. Perhaps they were telling us to look into the truly innovative frameworks, such as Lift (for the Scala language), or even Ocsigen (for the OCaml language). But no. They decided to go back to PHP!? I am confused: is this story about S&M fetishes?
I have been using Ocsigen myself for a few months now. It is based on OCaml, so it's very high-level while still being extremely fast (it can be compiled into native code, comparable in speed to C++). Moreover, OCaml has very strong types, and Ocsigen leverages that type-safety to ensure the produced markup will always be Xhtml compliant and that there are no inconsistencies or broken links within a website. Heck, you can even extend that type-safety into the database access, so there is no chance that you'll be processing data the wrong way. And best of all, all mistakes are detected at compile-time! It really is a pleasure to use...
-
Re:Refactoring
Haven't you heard? Java 2.0 is out. It broke source but not binary compatability. It's called Scala.
-
Re:getting tired of Java ...Really?
I think this is about the most interesting period for Java GUI there has been with work like the Cosumer JRE and Java FXStill if you fancy looking at something new Scala looks quite interesting.
-
Re:Nope.
Parallel programming does not have to be hard. All that stuff you learn in programming basics about deadlocks and semaphores and stuff really is hard, but there are easier ways of parallel programming.
Check out the communicating event loops of the E language or the actors of Scala. Asynchronous message passing removes the deadlock problem and makes relatively easy to understand programs. -
Re:Java -- no standards, JVMs aplenty