Questions tagged [scala]
Scala is a general purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles.
240 questions
0 votes
0 answers
87 views
How to connect to SFTP using Apache Spark 3.5 with Scala 2.12 for parallel file transfers?
I am working on a project where I need to transfer thousands of files (each sized between 50-60 MB) every hour from an SFTP server to local storage or AWS S3. I am using Apache Spark 3.5 with Scala 2....
0 votes
1 answer
253 views
Sharing akka actors on multiple backend instances
I have a web applications (angular) which is connected to backend using websockets. The role of web app is to display data from multiple sources (which are updated constantly by some Scala Spark apps) ...
0 votes
2 answers
1k views
Good design for a class with multiple methods to test but one public method
I've been trying to refactor some existing code which is in essence a giant nested procedural call inside what should otherwise be an object oriented architecture. The entry point to the relevant code ...
-2 votes
1 answer
693 views
Export huge excel file
I develop a web application in Angular (frontend) and Scala (backend) for a big data team. Because they use large files for export/import, I build a module which is a copy of Microsoft Excel. So, what ...
1 vote
1 answer
230 views
How to avoid code duplication from handling "structually similar types" in Scala?
Often, when programming, you'll have different degrees of information to you in different contexts. For example, a web server may have two routes, which recieve information about a Person, one of ...
1 vote
1 answer
212 views
Is my server design safe regarding multiple threads and concurrent database reads/writes?
I'm making a chat server using sockets and a MySQL database, and after it's working I want to expand it to become a more complex game server. I want to know whether my design is missing anything. ...
0 votes
1 answer
358 views
Why is this "more efficient" version of a Scala Collatz solution slower than tail recursion?
I implememted two versions of the collatz problem and felt an icy terror in the pit of my stomach as an optimized solution was slower than tail. The tail recursion is simple: // calculate the next ...
0 votes
2 answers
2k views
Scala Option apply method when passed a None
Not sure if this is an appropriate question for here, please let me know! In Scala, the ever so useful Option class has an apply method in its companion object that allows us to quickly wrap any ...