Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8521237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:45:55+00:00 2026-06-11T06:45:55+00:00

We have a java system that is implemented in several layers. On the lowest

  • 0

We have a java system that is implemented in several layers. On the lowest level, there are services which abstract a range of infrastructure components such as database, blob-storage, processing-queues etc… On top of that, we have the domain layer that implements workflows that use one or more of these services (using command and compound-command patterns). Finally there is a jax-rs (jersey) based layer on top of that, which provides a REST interface/protocol implemented in terms of the workflows from the domain layer.

My experience with Scala is limited, but I suspect that it might be a good tool to write a more expressive version of our domain layer because the Java code is quite verbose and hard to debug at times. Partly because the control of command composition and execution is handled by base-classes that are extended by concrete commands. In hindsight, this might not have been an ideal design choice.

I hope that this very high level description serves to illustrate what I’m trying to achieve. Let me know if I need to get more specific. I’m mostly interested in how the domain layer could be build in with Scala while keeping the Java based service layer. Furthermore, suggestions on how to implement the http/REST protocol on top of the domain layer so that it can be deployed in a java web application container would also be very interesting.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:45:57+00:00Added an answer on June 11, 2026 at 6:45 am

    Tactically an obvious starting point is to take advantage of Scala’s structural typing and look at representing your commands as traits:

    trait CommandType1 { def operation() }
    

    It is then possible to build your command compositions out of these traits:

    case class CompositeCommand(commandOperand: CommandType1*) extends CommandType1 {
      def operation() = commandOperand foreach { _.operation() }
    }
    

    Another advantage Scala has over Java for your workflow layer is that you can define your commands as passable functions. This opens up the possibility of creating general high level commands representing abstract operations, and then creating and storing partial functions of these commands for your commonly used/accessed workflows.

    The front facing Scala protocol layer could look at spinning up actors to deal with incoming requests. Additionally it is probably worth looking at something like Scala’s Cake Pattern to provide DI to control your business logic, and into multimethods for dynamic dispatch in your front-end code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java system that consumes an API. A few days ago, we
I have a single installation of java in a system that runs 2 or
We have a system that has some Bash scripts running besides Java code. Since
We have system here that uses Java JNI to call a function in a
I have a Java servlet that receives data from an upstream system via a
I currently have a small text game I've written in Java that utilizes System.out.print();
I have an existing system built in Java we currently expand that by adding
I have a Java applet that will consist of several popup menus that the
I have the following algorithm implemented in Java which uses TCP/IP: -Client request a
I have implemented this example into my application: https-clientserver-grizzly Here is Server.java from that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.