6

Functional programming is about minimizing states and all that comes with that. Any and all information that would normally be provided by class members is instead provided through parameters. It stands to reason that using classes in general is somewhat not functional as it allows you to have states. However, if you are avoiding class members, it makes ...


5

You are confusing dependency injection (DI) with the more specific idea of using a DI framework to supply those injected dependencies. remember that it's perfectly possible to use pure DI to inject dependencies without a framework. So the answer to the question, "Is it good to use dependency injection in a java library?", is "yes". As a default state, you ...


4

Indeed a full scale Java/Spring/Hibernate/JSF implementation may be a bit too engineered for the requirements of many small scale systems, however I typically evaluate new application requirements on the following factors to help myself determine the appropriate architecture: Anticipated User Load What is the anticipated user load? Are there potentially ...


4

If I understand, this is stateful since a call to a secured API required actually two calls This is stateful because the information „user X has been authenticated at time T“ is maintained on the server side. Of course, user would have to sent each time its credentials (or API key) A user can also sign each request to attest her identity, thus proving ...


3

@CandiedOrange answer is fine, it depends whether you are o.k. with ignoring the error. But, to elaborate, you should consider this question: How rare or "exceptional" is it to get an invalid fooParam? If you are reading from some "respected" database, REST endpoint, etc., bad inputs should be rare, and you should lean towards throwing an exception. If ...


3

The right answer is entirely dependant on the clients needs. You were trying to construct an object because you wanted to use it. Now, one way or another, it's not going to exist. That's a problem. What should be done about that? You use optional when the correct response to the problem is to do nothing. Optional does nothing very well. Easier to read then ...


2

I would yes, you still can use it for SPA. Play! framework is a stateless framework and it is suitable to write REST API. XML and JSON response, forms validation, Asynchronous HTTP are built in the framework. Akka integration also! I would say these features are convenient for SPA. Build your frontend with anything you like (Angular.js, Ember.js, ...


2

It's important to note, first of all, that the Play ScalaJSON library uses Jackson. In effect, it is a wrapper around the parsing/formatting engine provided by Jackson, so it's a really good alternative. It provides a nice API around a very fast engine. Now, the library I'd pick today for any JSON work would be Argonaut. Argonaut is a true functional ...


1

It's been many years since I've used Akka and have never had to deal with it clustered, but some quick research suggests Akka Scheduler isn't really meant for long-term jobs like this, and that you should use akka-quartz-scheduler instead for this sort of thing. Both of these have an instance per actorsystem, so you still have the same problem, making only ...


1

Q: Is it good to use dependency injection in a java library? This is totally up to you. However, imposing a specific framework or tool to make the library to work could dissuade developers from adopting the library. Those concerned by design best practices could argue that such a library is locking the application to a specific transitive dependency. In ...


1

Personally, a rewrite sounds more efficient to me, but if you need to do it in stepwise pieces I would suggest you take the following approach: Move your existing database code to use Slick (you'll probably need wrappers around it to shield your existing code from too many changes). Next, integrate Play into your runtime and use Silhouette for ...


1

It doesn't have to lead to confused code, but there are trade-offs. Sometimes you may find that your ORM is pulling all the fields of data from a row when you only need two, sometimes the queries would not be the same as those you would use or you may need to get a greater depth of entities than the ORM will automatically query so you end up going back to ...


1

Your concerns are valid. Default pattern of Rails-like frameworks are great for small(er) programs coded by less-experienced programmers that don't have a grasp on software architecture -- framework provides a skeleton for the whole application, all abstractions are defined, after coding 3 classes we have something on the screen. This use case is also good ...


1

If the framework is used as part of an application that involves a database back-end, then it may be useful to have persistence of the data in a form that doesn't require the physical database. For example, I can remember a previous workplace that used Fluent nHibernate as the ORM tool that would be used translate database tables to objects. This would be ...


Only top voted, non community-wiki answers of a minimum length are eligible