Bob Dalgleish
  • Member for 7 years, 10 months
  • Last seen more than a month ago
DRYing out some Java code and tests
6 votes

First off, testing is inherently repeated. You are exploring many facets of the same attribute of your program, which means doing many things in slightly different ways. Your job is to control the ...

View answer
BFS tree traversal Scala
3 votes

Several points: Why do you have var fields for your case class? Unless you have a good, conscious reason for doing so, you should leave them as vals. In enqueue, you refer to Queue while you have ...

View answer
Ported C# scheduling to Scala
2 votes

Anything to do with time is inherently stateful but your code doesn't have to embrace statefulness quite, but Scala gives you some tools to address that. Scala has simple construction of ...

View answer
Key / Value store with type classes for formatting / parsing
Accepted answer
2 votes

I don't see how to understand the KeyValueStore without understanding the ValueFormat implementation you reference. You don't have any substantial comments in either implementation, including "why". ...

View answer
Generic repository pattern
1 votes

I presume that each of your entities are completely independent from each other, that none of them refer to each other, nor do you perform compound queries. Also, the entities are updated or created ...

View answer
Creating elements with special corners
1 votes

Your div structure may be the minimum you can get away with. module-wrapper holds the whole thing, and the sub-modules are required to differentiate the pieces. I have no idea what your statement, "I ...

View answer
Transforming a list of maps representing bands
1 votes

You might consider using map on Option to more cleanly access the values. def set_canada_as_country(band: Map[String, Any]): Map[String, Any] = { band.get("name").map( name => band.get("...

View answer
An enum that has situationally invalid entries
1 votes

I believe you are confounding two concepts. The first concept is that of a turn signal, which is in one of three states: left-blinking, right-blinking or neither. The second concept is the state of ...

View answer
Functional SaveObject in Scala
1 votes

You are mixing a repository with a classifier. The classifier is not doing anything except separating out keys from non-keys. The repository doesn't do anything with what it holds. You convert strings ...

View answer
PRNG - Algorithm: Performance vs Readability
Accepted answer
1 votes

There is no one answer. Performance How often is generate_normal called? Is it called on a program critical path or only during set up? Could you cache a bunch of numbers before hand and only ...

View answer