All Questions
Tagged with scalaobject-oriented-design
7 questions
1vote
1answer
435views
Preferable design for overriding sealed trait method in Scala case classes/objects
Say I have a sealed trait Person that requires the definition of a method work :: Unit -> Unit. I then have three case objects Accountant, Doctor, and Lawyer. I can think of two ways to implement ...
4votes
0answers
306views
Should I pass presenter to use case when implement clean archeiture using scala
This question came to me when I was trying implement Clean Architecture using Scala, and come across this post. In the accepted answer, @candiedorange emphasis on the separation of responsibility, and ...
2votes
2answers
184views
Trait and Implementation vs just Implementation
In my previous Java job, we tended to avoid defining interfaces for everything unless we genuinely had multiple implementations for it. This may just be my opinion, but if there is only one ...
3votes
3answers
454views
Is 'design with types first' ultimately the same as 'design with interfaces first'?
In Object Oriented Programming, we're taught to think in terms of Polymorphism (the idea that the implementation is decoupled from the interface - and that it makes sense to think of the interface ...
8votes
1answer
3kviews
When to declare @throws with a Scala annotation - abstract parent or concrete implementation?
In this StackOverflow question I asked about the behavior of the @throws annotation in Scala. Now that I understand how it works I want to ask about best practices with using it. Here's a repost of my ...
9votes
2answers
4kviews
What is the difference between self-types and trait inheritance in Scala?
When Googled, many responses for this topic come up. However, I don't feel like any of them do a good job of illustrating the difference between these two features. So I'd like to try one more time, ...
11votes
4answers
2kviews
Design in "mixed" languages: object oriented design or functional programming?
In the past few years, the languages I like to use are becoming more and more "functional". I now use languages that are a sort of "hybrid": C#, F#, Scala. I like to design my application using ...