As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Which tools or libraries do you wish existed in the Scala ecosystem?
Are there any existing ones you wish were greatly improved?
In no particular order:
A Scala version of the Clojure Incanter libraries would be very handy indeed, and could probably be even nicer to use than Clojure's.
It would also be exceptionally cool if the parallel version of the 2.8 collection library had been ready for (todays!) 2.8 release, rather than waiting for 2.8.1. Even cooler would be something with the power and feel of the 2.8 collection library which offloaded calculations to something like Hadoop.
Standard library support for software transactional memory would be very nice.
The IntelliJ IDEA plugin for Scala is an amazing piece of work, but (unsurprisingly) still lags behind Java in some annoying ways, particularly in on-the-fly error reporting.
There need to be some standard shims built so that various "enterprise" libraries (Spring/Hibernate/Ibatis/Freemarker, etc.) can use Scala objects without scattering #BeanProperty annotations around and without using Java collections objects.
A single lib for time, money and physical units would be cool
Scala Swing should be more complete (and more consistent)
Would be nice if the DBC lib for wrapping JDBC access would be finished
A Scala 3D engine would be awesome. Simplex3D and Sgine are on the way, but it's a long way...
I think it is important not to pack too much functionality into Scala. It is really easy to expand Scala on your own, so let's do that for a while. Then, when some framework emerge as a winner, this might shipped with Scala.
For those of you who have suffered the result of the JCP committee, please remember the disasters of premature standardizations.
That said, I have my own wish list :-) I would like a simple DSL for Date. The one from DPPs book would do.
Off the top of my head:
A good scala <-> JDBC bridge.
A good mocking framework.
Scala wrapper for Spring DI.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Just wondering if anyone knows of a web-scraping library that takes advantage of Scala's succinct syntax. So far, I've found Chafe, but this seems poorly-documented and maintained. I'm wondering if anyone out there has done scraping with Scala and has advice. (I'm trying to integrate into an existing Scala framework rather than use a scraper written in, say, Python.)
First there is a plethora of HTML scraping libs in JVM all you need to do is pimp one of them (pimp my library pattern).
The four I have used are:
HtmlUnit - Will emulate the browser and even run Javascript
Jericho - Preserves formatting and ideal if you want to edit the scraped HTML
NekoHtml
JSoup -- does not work with Scala. Might work
I have used Selenium but never for scraping. Scala has a wrapper around selenium.
I would recommend pimping an existing Java library over some half baked Scala lib.
I don't have a Scala-specific recommendation, but for the JVM in general I've had good success with:
JSoup You can CSS selectors to "scrape" the document. Really nice to work with.
Use Tagsoup to get your input HTML to XML, then use XML processors to "Scrape".
The Tagsoup route actually works quite well with Scala since Scala's built-in XML "dsl" is pretty concise (if you can forgive its perf issues and occasional API weirdness). Also, Tagsoup will handle nearly any garbage document you give it. It also has niceties like built-in understanding of many HTML entities that other SAXParsers will choke on as being undeclared.
tl;dr - JSoup + CSS selectors if possible, otherwise Tagsoup + scala XML. If slow is ok, tagsoup first, then jsoup the result.
I'd recommend Goose: https://github.com/jiminoc/goose
It's not as general-use as you might need but if you are scraping article content from popular sites, it may work out of the box. It also provides a framework for you to work from if you want to extend their code to cover other sites.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Many Java x Scala comparisons seem to focus on the language alone (syntax, collections api, actors, etc) but what about enterprise application development?
If you want to build a distributed enterprise system using Scala, would you code a traditional Java EE application using Scala syntax (e.g. EJB compatible class using Scala syntax) and run it in a Java EE container, or is there a Java EE replacement in the Scala ecosystem?
If the second, so far the closest thing I found is the typesafe stack; is it Scala's replacement for a Java EE container?
Is Akka a JMS (and possibly Session Beans) replacement or would your Scala system still leverage Java EE services?
Well,
Scala / Akka offer different concepts for many of the common pitfalls
in system development. To compare just a few to Java EE:
=> JavaBeans:
Mutable Data-structures are just plain evil and not thread-safe.
Putting them into a container doesn't change anything.
Use immutable data structures instead, as scala enforces with CaseClasses.
=> EJB:
Composition of EJBs just sucks. The actual problem is that EJBs need to have a high level of cohesion to be useful in terms of re-usability which is hardly the case in practice. Stuffing them into a container wan't make it any better. In Scala, using traits,
for composition enables you to use ad-hoc composition through constructor injection protected by f-bounded polymorphism. Life can be so easy.
=> Transactions:
Yes transaction managers already make things better but it's still
requires the big Java EE stack to make it work. In Scala, just use Software Transactional Memory (STM) as provided by akka and you're done.
=> Persistence:
Do we really need ORM? Projects like squeryl.org add strongly typed LINQ to Scala.
Instead of heavy-weight query language mapping, as Hibernate does, it just integrates
queries into scala, fully checked by the compiler. This is of course only true for relational DB's. For no-sql, there are other solutions available.
=> Scaling?
Clustering Java EE? Do I need to say more?
In akka you just add a few more server and the system just scales. Why? Because
remote actors are treated and accessed the same way as local actors and everything
else is just a matter of configuring your distributed actor system. Akka is based on
the Erlang model, so they do not look for five-nine up-time but nine-nine up-time
under full system load.
At the same time, akka is so easy and light-weight that you
can use it on Android. Would you try to run Java EE on Android?
https://github.com/gseitz/DiningAkkaDroids
To be clear, maybe ten years ago, Java EE was the answer to the question how to build
large enterprise grade software and, once Spring has made it usable, it was maybe the best available solution at those days.
Today, the world has changed a lot and most of the old answers do not fit today's reality anymore. Scala, is not perfect but if it really comes down to one single line it would b be this:
In scala, I get my actual programming done in a fraction of time the Java EE
and container setup would take.
Even Spring, as the framework of choice for Java EE is moving towards scala:
http://blog.springsource.org/2012/12/10/introducing-spring-scala/
To start with both, concepts and best practices for Akka, there is a handy
book called "Akka Essential"
http://www.akkaessentials.in/2012/12/adding-turbchargers-to-jee-apps.html
If you want Java EE, you can go right ahead and use Java EE with Scala. However, I don't know anyone in the Scala community who doesn't want to get away from Java EE (or continue to avoid it).
Akka is indeed a sort of "replacement" for JMS. Behind this idea (and your question) it is indeed a change of paradigm, and we must be aware of that, but starting from this fact i think akka had chance to be used very widely in the next future for several uses, from message passing to integration between distributed etherogeneus concurrent platform.
Typesafe stack is a stack, so i found unuseful to think that regarding Java EE contanier.
And last, the first answer: if you want to use the EJB syntax, please consider using annotations and you should have the chance to write EJB more or less in the same way as java, plus some "syntactic sugar" of scala
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I want to start working on a project where I want to build a intranet website and mobile app for people working in my office for car pooling. The basic idea is that if anyone is interested in looking for someone to carpool with should make a posting of going from A to B at time X.People can then reply to it.
I've narrowed down my option to Scala+Lift+MongoDB or Node.JS+Redis/MongoDB+HTML5. I don't know which one is better or worse for the problem I have mentioned. Also looking at developing mobile apps for the same application where people can send carpool request over their phones.Looking for a stack which can complement the mobile development also.
I know there are various solutions for this, but I'm looking to learn something new and exciting and have fun while developing it.
The only requirement that influences the technology stack is "looking to learn something new and exciting and have fun while developing it" (just as broofa said).
However I have no idea how he came from that requirement to JavaScript.
Yes it is more marketable
Yes there are way more people that know it.
Yes you'll need it any way.
But is JavaScript in anyway interesting as a language? Not much I'd say. Any nice unique (or at least rare) concepts? To me it looks like programming in java, but not being allowed to use anything but Hashmaps + java.lang.*
Scala on the other hand combines functional and object oriented in an extremely interesting way. It has a strong type system which enables tricks that probably will make your head spin.
And even if you don't use the really fancy stuff you have a super powerful language to work with.
So if you want to learn: Go with Scala
The capabilities of the technology stack here are probably unimportant. Both Scala and Node will allow you to implement a web interface / HTML5-based application for mobile devices.
So it boils down to your other requirement, "learn something new and exciting". If you're not familiar with node or JavaScript, I'd suggest Node because ...
JS is a much more marketable skill than Scala (currently)
If you want other people to work on this code, more people know JS than Scala.
You are only learning one new language instead of two. (You have to learn JS in either case to implement the front end. With Node, that expertise carries over to the server as well.)
... and even if you are familiar with JS, working with Node will make you a much better JS developer.
My $.02. You should get somebody who knows something about Scala to chime in here however.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm starting to understand Scala and I like it a lot.
How can you position yourself to get a paying job as a Scala developer (assuming those become more common)?
What parts of the Scala ecosystem have the best job potential (Lift, Actors?).
How can you gain credibility with a prospective employer without being able to point to Scala work experience (maybe experience on open-source projects?).
(The above questions are hopefully of somewhat general interest to Scala folk. If you want to factor my particular situation into your response, here are a few details about me: longtime developer (mostly Java) with a Computer Sci PhD; not currently working; I'm tied to a non-cutting edge location (Rochester NY), so I may be limited to remote work.)
Update 2010/07/30:
Thanks for the responses. I'd like to crank up the emphasis on the location issue. I'm tied by family to a location that probably won't have Scala work locally for a long time. Are there realistic prospects for getting remote Scala work, and if so how do you position yourself to get remote work? (A modest amount of travel would be doable, but not a full-on road warrior.)
Also, I was wondering about leveraging my teaching background. Would teaching a Scala class at a local university make a big difference in one's marketability as a developer, or just divert more effort than it is worth?
Pure Scala position:
Finding a pure Scala position is not very easy, but it is getting easier and easier. I am going on my first pure Scala job interview in a few days.
I hope we will see a lot of new systems being written entirely in Scala, and I think these systems will be mostly back-end, heavy duty systems. These systems will be using Scalas less error prone functional style to reduce bugs. I think Akka, SBT and Specs will be important frameworks for the Scala developer (this is not much of a prediction since they are already important).
If you do not find a pure Scala position:
Your credibility comes from your time with Java. Most big companies have heaps of Java code that must be maintained and developed. If it is your job to babysit the old Java code, and as an old Java guru, you should have some say in how this should be done. The first step is to change the Maven setup to allow mixed Java/Scala environment. Moving to SBT is probably your best choice. This is a one time investment you have to do or else you can not proceed!
If you work independently you could probably replace Java with Scala whenever you feel like, most likely when you have to re-factor some old code. Talk about Scala as a "framework" for Java (this is technically a lie) that boosts productivity when speaking to the non technical project manager, this might calm their worrying minds. In the end it will be your responsibility to see to it that Scala indeed integrates with Java. But since Scala does this very well it is not much of a problem. Actually, maintaining old legacy code is not a dream for anyone, so PMs are usually happy if they find anyone who would do it for more than 3 month. Management will probably put up with you rebellion.
If you work in a team it is a bit more tricky. In this case you have to teach the team Scala, or else they will not be able to understand your code. You have to persuade your PM to set aside resources for Scala training (might be hard). When you introduce Scala to a team, start small. My experience is that it takes a while for a Java dude to learn Scala, so this is not done overnight. Therefore, ignore everything that is "hard" when you teach Scala. When the team grasps the basics, start with writing tests in Scala (thank Davetron5000 for this tip), continue to use Java for programming in the application (the production code). Hopefully the team will learn and enjoy Scala and after that, well, it is all downhill from that point.
Good luck!
If I was hiring at the moment, I can tell you right now what questions I would be asking and they would be about the language. It is a hard language to understand at a deep level, even if it seems easy to use and, as a consequence, you might be expected to understand code written in a large number of different styles.
Knowledge of libraries (Akka and Lift being the obvious ones) the sbt build tool is great but it is an extra. I would want to know that you understand:
a bit (well, a lot) about the type system (and higher-kinded types)
something about the typeclasses approach
implicits and the pimp-my-library approach
good scala style (i.e. idiomatic scala)
recursion
the actors approach to concurrency
the standard libraries
functional programming
If you understand the language, you'll pick up the libraries with no problems, I'm sure.
Other libraries:
scalaz for functional programming
scalala for numerical programming (linear algebra etc)
scalaj for interacting with Java
I think your best bet is to get good at Scala and to get visible in the Scala community. These are not necessarily the same thing but luckily they are very closely related in the Scala community. Once you do this there are definitely opportunities to use Scala for fun and profit, whether as a consultant/contractor or as a (remote) full-time employee. As part of getting better and more visible I would recommend becoming active in one of the existing communities (Lift, Akka, ScalaNLP, you name it) or even going out in the wilderness and hacking away to solve a common problem, even if it's just making a native Scala alternative to a popular Java library (e.g. squeryl and Dispatch maybe weren't necessary but they're awesome).
I guess what I'm saying is that contributing to any good, useful Scala code will be good experience and I think the ecosystem is so young that there's no need (or benefit?) to specializing in only one part of it. Of course, if there's a specific subject that Scala is useful for and/or a specific field that benefits from Scala that jumps out to you, direct your attention in that direction.
Having had two full-time Scala jobs at this point, I'd say that the most important thing to do is learn the type system and the standard libraries inside and out. The individual technologies can then be picked up with relative ease.
Also, start using Scala (specifically Specs and ScalaCheck) for testing in your current project, today, if you possibly can.
Finally, as pr1001 said, get visible in the Scala community. Contribute to a project, interact on the mailing list, hang out in #scala on freenode, answer questions where you can.
Take your current job, and implement resume driven development. Just claim that xyz can't get done on schedule without Scala, and then use it. After that, take your project to success and either work elsewhere, open your own business, or continue developing Scala apps at your own company.
It worked for Dick Wall, so it should work for you. :)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
We have an application supporting plugins via interfaces. On the other side plugins contain lots of logic and code in themselves. Plugins have dependencies (project and dll references) to application libraries beside the interfaces that application exposes.
Application core libraries have lots of reusable components that can be used in plugins. But if any of these components change in anyway, both the plugins and application are affected, as both have dependencies.
Is it acceptable to have plugins containing dependencies on the system, that plugins extend? What are the best practices on this issue?
Please share your thoughts and experiences.
Take a look a Mono.Addins, even if you are not developing in C#, it will give you some great ideas.
The simple solution is to define a version system for the plugins and the core, so the core can read which version of itself the plugin needs. That way is easy to prevent the load of a plugin which was meant to be used with a previous version of the core.
I think there are two answers to your question, depending on the level we're talking about:
yes, it's fine to have a dependency of the plugin on the plugin host. The host is coordinating the use/execution of the plugin, but there is no reason for the host not to provide functionality to help the plugin do that. Extending that a little further, the host's dependencies may or may not be fair game for the plugin to use (this goes into the territory of "it depends...").
no, the plugins should not depend directly on code that the host could provide, except those objects that the plugin directly passes in. This is more a distrust on global state than a fear of circular dependencies.
I think it is totally fine to have you plug-ins referencing off of your core. Now you’re talking about project and dll references, so you must be using c#, vb or c++, these solutions all should be fine to use.
I typically have two projects, to get around the circular dependency.
Project Base, Interfaces, Exceptions
Logic/Configuration/Plug-in Loader
There are three ways I typically load plug-in
Out of a directory using loops and the filesystem watcher (slow but effective)
Use your own configuration section in .net using named types (recommended and fastest)
Load them from a database (good for scalability)