8 ms·
Choosing Scala
- _random_ 13y agoC# and F# would also be decent choices former being further in and the latter farther from abstract C-like comfort zone.
- agumonkey 13y agoI see more and more F# on my twitter feed, it seems a very very nice language, terse, expressive and pragmatic. psedit: I can't resist one of my favorite f# article http://blogs.msdn.com/b/ashleyf/archive/2012/01/26/hp-35-microcode-emulator-in-100-lines-of-f.aspx http://blogs.msdn.com/b/ashleyf/archive/2012/01/26/hp-35-mic... also, arrayForth chip emulator : http://blogs.msdn.com/b/ashleyf/archive/2013/09/21/chuck-moores-creations.aspx http://blogs.msdn.com/b/ashleyf/archive/2013/09/21/chuck-moo...
- mynegation 13y agoComing from CS and computational math background, I used mostly C++ for production and Python for prototyping and data analysis. I wanted to learn some new language for JVM, Clojure and Scala being the main (if not the only) contenders. I may learn Clojure anyway, but what tipped the scale to learning Scala first was wonderful Coursera course in functional programming by Martin Odersky, using Scala as a language, obviously. A very short summary of my impressions from Scala: * It is beautiful, I felt the half-forgotten beauty of functional programming once again * Scala worksheets (quick scratch to evaluate whole code snippets with immediate feedback) are awesome. I love them even more than REPL (Then again, I love IPython notebook more than Python REPL too) * Scala seems a bit heavy in terms of number of concepts * Scala can be terse and very expressive, but pretty verbose if you need it to be * Compilation of large programs is slow and eats gobs of memory * tail-call optimize everything
- TylerE 13y agoMight want to take a look at Nimrod (http://nimrod-lang.org/ http://nimrod-lang.org/) * (Mostly) Python-ic syntax (indentation-based) * Type inferance * OOP (but only when you want it) * Good expressivity * Compiles via c (FAST, easy linking with C libs, no runtime required, prodoces standalone binaries) * Lean core (Not a "kitchen sink" language, but has good support for FP and OOP)
- kvtrew76557 13y agoI'm rather excited about Nimrod, it actually looks a bit like Scala (pascal-style declarations). Scala has a lot of appeal for (most) organizations where the JVM is very widely used. I guess I tend to look at things from the position of a software engineer rather than from a teaching perspective. I'm really hoping that Nimrod gets a lot of traction (don't want it turning into a D).
- rz2k 13y agoAre you aware of the follow-on course? https://www.coursera.org/course/reactive https://www.coursera.org/course/reactive
- mynegation 13y agoYes, I am following that course, thank you! Although due to crunch at work I am not doing assignments for this one.
- agentultra 13y agoI really want to understand what the fuss is about with Scala so I fired up a REPL and found a tutorial and went to work. Then I can across this: scala> print("5" + 5) 55 And I stopped there (for now). At least my C++ compiler will warn about that (although it will still compile even if it doesn't print anything save for the newline): #include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << "5" + 5 << endl; return 0; } Python gives me a TypeError. And so does Common Lisp. I was expecting the same from Scala; a language which purports to be a multi-paradigm language with static type inference and a strong functional programming bias. Not even a warning. What's the reasoning behind this in Scala?
- jmount 13y agoI am hoping reasoning is in a non-print application the type of the captured value will be compile time checked elsewhere. But if the language is willing to cast both ways between int and string then there is no safety (no idea if it does do that). Also I do agree with your points (explicit and implied) I don't see "hey free parsing" as a big enough advantage to infect the language with these sort of implicit conversions.
- ape4 13y agoThis is handy for something like: scala> print("The result is " + iResult)
- jmgao 13y agoIt's inherited from Java, where adding something and a string will implicitly convert the something into a string. The C++ behavior is notably worse, though: "5" + 5 in C++ is undefined behavior, and will give you a pointer to some mystery data.
- agentultra 13y agoThe example is merely illustration and not the recommended practice for writing C++! (Can you imagine?) I only meant to illustrate that even in C++ where types have a different meaning I will get a warning with a decent compiler. In either case the expression in both languages garners a silly result. However Scala is happy with the result and reports nothing wrong with it (not even a warning). I was just surprised is all.
- kvtrew76557 13y agoAs a software engineer I find Scala to be a very powerful tool, but one which takes some time to learn. I could see it being a useful teaching tool if they stay away from obscure corners of the language. I'm glad that they didn't go with Java, but I'd only go with Scala if the students are a sharp bunch. Python would also have been a suitable choice.
- sampo 13y ago> "I'm glad that they didn't go with Java" That School (Aalto University) has used Java as a first year language for quite some time. Then they switched to Python (I think), and then to Scala. Before Java, it was Scheme. Before Scheme, I don't know.
- yelnatz 13y agoMy university switched from Java to Scheme (Racket) for their first year language. I'm not sure why they're trying to scare the poor first years away.
- parasubvert 13y agoI think Scheme is a good second year language, which is really when The Fear should set in among the uncommitted.
- dkhenry 13y agoAll very good reasons to use Scala for teaching. I think you will also find that those students who really get it will sink there teeth in deep and not hit the bottom of the language any time soon. Thats good for those kids in the class who are comming into the university with programming experience. I know when I was doing my introductory programming classes I spent more time trying to figure out neat things I could do with C++ and Java then actually working on class work.
- saryant 13y agoMy alma mater recently switched to Scala for its intro courses, my undergrad thesis mentor really pushed for it and has written an intro textbook using Scala. He's also the reason I used Scala for my senior thesis, which led to me suggesting it at the startup I work for (first hire) and Scala becoming the basis of our backend. I think the OP really nails the reasons Scala makes sense as an intro language. Students can start with simple concepts and gradually see how these lead to the complicated stuff.
- leokun 13y agoI don't come from a CS background, but I have been programming professionally many years and recently got started with Scala. I had tried Go before and I like Go. I also really like Scala. Scala requires much more work to learn than Go. I don't think I ever ventured out much from the offical Go documentation, the spec and effective Go and the library documentation to learn Go. With Scala I've already bought 3 books, and have bookmarked nearly 100 sites. I frequently have very many tabs opened with various scaladocs, examples and stackoverflow questions open. My favorite thing in Scala is Akka. I quite like Akka and I like the functional programming that's possible with Scala. The build tools, like sbt require getting used to but I'm able to pretty much get along just fine without an IDE. I do have intellij open but I hardly look at it. I do all coding in vim and testing with sbt. About 14 days in and I can connect to TCP and parse JSON ok. That's where I'm at. There have been some pretty frustrating moments, mostly dealing with 3rd party libraries (like scalaz, not documented much) and sbt, but once overcome it feels rewarding. My other favorite things in scala: it has a REPL, s"String $interpolation" and pattern matching.
- deleted 13y ago[deleted]
- bad_user 13y ago> With Scala I've already bought 3 books, and have bookmarked nearly 100 sites. I've also written a blog post about learning resources. Maybe it helps you: https://www.bionicspirit.com/blog/2013/05/13/getting-started-with-scala.html https://www.bionicspirit.com/blog/2013/05/13/getting-started... As a word of warning, don't use Scalaz while in the learning process. It's a pretty cool library, but I've been developing with Scala for the past 2 years already and personally I've never felt the need for Scalaz. Akka is great, the standard library is great, Play is great. You can also use any Java library you want and wrapping Java libraries in Scala-ish interfaces is great for learning ;-) > Scala requires much more work to learn than Go. This is true. Go is more familiar because it has a less complicated (and unfinished) type system and because it doesn't contain too many unfamiliar concepts to developers that are used to mainstream languages. For example in Scala you end up seeing a lot of flatMaps() being used on monads, you also see type-classes or persistent/immutable data-structures, or the CanBuildFrom pattern which looks intimidating at first, but it's actually rather nice. Scala's type system is also much more static and more expressive than that of Java, Go or C# and I'm specifically talking about generics. Scala makes it easier to write statically type-safe generic code, so of course, people end up wanting more and some of them go crazy with that. Being a static functional programming language, the type system is intimidating at first, but as you learn about it, you'll see that it's elegant and much thought went into designing it. And most importantly, it helps you to write better code, instead of just staying in your way. Scala also contains simplifications versus other mainstream languages. In comparison with C# or Java, in Scala there is no such thing as static methods or members. In fact, in Scala all member accesses are considered method calls. This has great implications for polymorphism. In comparison with other languages that mixed OOP and FP (e.g. F#, Ocaml), in Scala all types are modelled by means of classes or traits. While using other languages, you'll notice that OOP (sub-typing) is a pain in combination with generics because covariance/contravariance is a bitch to deal with. Java's generics are broken, because at the class level they simply don't deal with it (they preferred invariance) and then for the methods themselves you've got to use wildcards. Scala is much saner in that regard. It also has a unified access philosophy that really simplifies things and the marriage that it achieves between OOP and FP is really good. In my opinion, only Clojure's protocols are on the same level while being somewhat simpler, but that goes with the territory of a dynamic language. Anyway, Scala's learning curve may seem intimidating, but (1) it's worth it because you learn a lot about FP with Scala (the ML style, not the LISP style, which is slightly different :)) and (2) you don't need to use advanced concepts to write working code. Have fun,
- eranation 13y agoIf anyone wants to get a taste of Scala, and don't want to install anything, I created http://scalatutorials.com/tour http://scalatutorials.com/tour, (no sign up, no installation, 100% free and open source) with syntax coloring and lightning fast execution of code (thanks to scalakata.com, and Scala's presentation compiler) If it looks familiar, I was a "bit" inspired by the "Tour of Go"
- dyadic 13y agoI really wanted to like Scala, I came to the language looking for a Haskell on the JVM, but then just found it sacrificing too much, mainly for Java compatibility. The close compatibility with Java does allow an easy transition for Java developers, but it's a transition to writing what it repeatedly deemed unidiomatic Scala by the Scala community. And then I've seen the same community scoff at unenlightened Scala developers that are writing "Java++". Half of Scala could make a really nice language, but the complexity of the full thing is not something I want to work with again.
- bad_user 13y agoYou call it sacrificing, I call it awesomeness. Scala achieves the best marriage between OOP and FP available. If you come from Haskell, you can view that as a sacrifice, of course. But I don't, to me that's a strength. Scala is not Haskell and Haskell is not Scala. If you use one and expect the other, you'll be disappointed.
- eklavya 13y agoI really want universities here to pick up Scala as well. You can teach all aspects of modern programming paradigms using it, while retaining real world applicability and the wonderful JVM and it's ecosystem. I use typesafe stack and it's really, really good.
- francis- 13y agoBefore you think about using scala watch this: http://www.youtube.com/watch?v=TS1lpKBMkgg http://www.youtube.com/watch?v=TS1lpKBMkgg
- asdf1234 13y agoPaul could do a similar talk for basically every mainstream language. Better not learn anything!
- room271 13y agoI use Scala in my job and, though I never formally studied CS, I would be concerned at using it for an introductory course at university. Scala is fundamentally a pragmatic language - it is about compromise between functional purity and JVM/Java-style (OOP-based) mutation. As such, it's hard to really identify the distinctive features of either because Scala is so liberal in what it allows. I wonder whether students would be better off learning something like Haskell along with (e.g.) Python or Java. And of course a Lisp of some kind(!).