Live data from Hacker News

Play Framework 2.0 Final released

playframework.org

51–60 of 61 posts

Re: Play Framework 2.0 Final released

#51
post #43
post #31

Earlier quoted context omitted.

Not much of a fan of the new Typesafe Stack. It doesn't seem to install the scala, play and akka command-line tools like the old versions did. Is there a way to get a straight Scala REPL, or does everything have to go through giter8 and sbt now?

You can get it directly from scala-lang.org: http://www.scala-lang.org/downloads

I was aware of that, but it seems silly to have a separate installation of Scala just for the REPL when the stack includes most of the important stuff already.

I guess that I'd be better off just using the individual components instead, for now. With the new version it feels like they've switched from being a fairly plain "distribution" of Scala/Akka to more of an opinionated tool set based on giter8 and sbt. That's a pretty big jump, and I'm hoping that the lack of command-line support tools is something that's fixable once things are settled a bit.

Re: Play Framework 2.0 Final released

#52
post #46

Earlier quoted context omitted.

If you wanted to unit test this I'm confident you could do it using JMockit [1] without changing the code. JMockit allows you to mock just about anything (static methods, final methods, constructor invocations). The unit test might look something like: @Test public void checkIndexRenders() { final List expectedforums= new ArrayList(asList(TEST_FORUM)); new NonStrictExpections() { @Mocked Forum forum; @Mocked Topic to…

Apologies for the tangent, but is this considered idiomatic Java these days? As a person who knows/knew Java pretty well but has been out of the game for a few years, this code seems highly surprising. Instantiating an anonymous subclass with a static initializer to... I suppose be able to use those @Mocked annotations. Then assigning result in that anonymous initializer block, which I must assume works through black…

Generally this would not be done in production code. jMockit is pretty out there, syntax - wise, and the anonymous inner classes are generally discouraged in production code. In tests are generally fine though. which is why jMockit can get away with it.

Re: Play Framework 2.0 Final released

#53
post #31

It's also now part of the Typesafe stack - here's the release announcement from the typesafe blog: http://blog.typesafe.com/introducing-play-20

Not much of a fan of the new Typesafe Stack. It doesn't seem to install the scala, play and akka command-line tools like the old versions did. Is there a way to get a straight Scala REPL, or does everything have to go through giter8 and sbt now?

The new typesafe-stack deb package also wants to install all of OpenJDK as well, even if you've got Oracle JDK already installed and on the path.

Re: Play Framework 2.0 Final released

#54

Earlier quoted context omitted.

I partially disagree, especially with backing from Typesafe. The "engine" benefits from Scala, as a highly concurrent and transactional heavy system. The choice of language for building MVC applications & services on that engine is left up to the developer. The 2.0 mindset, and you see this in everything is very much a best tool for the job balanced with flexibility and choice. It's going to take a little while for a…

> It's going to take a little while for a language like Scala (or any JVM based language) to fully penetrate the market. By a wide margin, the overall consensus in the JVM community seems to be that Scala will probably never be more popular than it is today, which means, it will never become mainstream. Hopefully, one of Ceylon or Kotlin will succeed where Scala failed. With that in mind, Play betting on Scala is qui…

+1 can you please backup your claim? Scala does not need to be Java popular to be usable (probably no alternative JVM lang will ever be as popular as Java - especially now that Java is evolving).

also, play is not "betting" on scala. Just because it was implemented in scala and provides a scala API that does not mean you can not use the framework from Java (or Kotlin, or Jruby etc.). If you do not care about the scala API, that's fine, use the Java API instead.

HTH

Re: Play Framework 2.0 Final released

#55
post #19
post #16

Earlier quoted context omitted.

This is the first controller I opened from their samples[1] : public class Forums extends Application { public static void index() { List forums = Forum.findAll(); long topicsCount = Topic.count(); long postsCount = Post.count(); render(forums, topicsCount, postsCount); } ... } You can't mock out Forum, Topic or Post. You can't inject some type of "FormRepository" or whatever pattern you want to gain some type of con…

This looks pretty much like standard JPA stuff.

I don't think JPA requires or encourages you to use static methods.

Re: Play Framework 2.0 Final released

#56
post #51
post #43

Earlier quoted context omitted.

You can get it directly from scala-lang.org: http://www.scala-lang.org/downloads

I was aware of that, but it seems silly to have a separate installation of Scala just for the REPL when the stack includes most of the important stuff already. I guess that I'd be better off just using the individual components instead, for now. With the new version it feels like they've switched from being a fairly plain "distribution" of Scala/Akka to more of an opinionated tool set based on giter8 and sbt. That's…

Then are you just asking how to get a Scala REPL using sbt?

If so, you can get one by entering the command 'sbt console' in a project directory. This will give you a scala console with the added bonus that all of the files in your project will be loaded as part of the REPL's classpath.

Re: Play Framework 2.0 Final released

#57
post #23
post #16

Earlier quoted context omitted.

This is the first controller I opened from their samples[1] : public class Forums extends Application { public static void index() { List forums = Forum.findAll(); long topicsCount = Topic.count(); long postsCount = Post.count(); render(forums, topicsCount, postsCount); } ... } You can't mock out Forum, Topic or Post. You can't inject some type of "FormRepository" or whatever pattern you want to gain some type of con…

So would the appropriate approach in this case be to create IForum, ITopic and IPost interfaces and, instead of calling findAll() or count() directly on the class, call it on the interface so a class can be injected? Sorry...this is all a bit hazy to me. It's been years since I've had to deal with these sorts of concerns.

Something like that..but then the question is: how do you get the instance in there? Normally through DI (ideally at the constructor level)...but the static method screws that up.

I agree that worrying about this is silly, but such is the life of someone who uses static languages.

Re: Play Framework 2.0 Final released

#58
Sorry for being "rantish", but most of the "negative" comments I'm reading around here are from people who didn't spend a single second reading the manual.

Yes, I'm not partial, I'm invested on Play, but I am because it has a wonderful documentation that makes life really easy (that plus StackOverflow).

Most of the complains in here come from people with almost no experience in it. No, a small side project of 6 hours is not "experience". You just toyed around. You can't know about the real issues or benefits related to a framework.

Please, I know this is "the internet", but in a site like Hacker News, couldn't you try to talk only about things you know?

Re: Play Framework 2.0 Final released

#60
post #16
post #15

Earlier quoted context omitted.

Can you elaborate more on the untestable code point, for those of us who've been spending more time on ruby lately? I find play very interesting, but it's great to hear about its warts as well.

This is the first controller I opened from their samples[1] : public class Forums extends Application { public static void index() { List forums = Forum.findAll(); long topicsCount = Topic.count(); long postsCount = Post.count(); render(forums, topicsCount, postsCount); } ... } You can't mock out Forum, Topic or Post. You can't inject some type of "FormRepository" or whatever pattern you want to gain some type of con…

What you're complaining about is just the data access which happens to be used in this sample (particularly some convenience methods which aren't even necessary), which you can freely change out with any technology that you please, because it's completely orthogonal to the rest of the framework. The framework has no abstractions over or requirements for the data access framework.

Or without even changing the data access calls you could just put them behind a DAO object, which would have been injected and therefore easily replaced for testing. But that wouldn't have made the sample any clearer.

Post reply on HN