Skip to main content
17 votes
Accepted

Why not use an ORM with DDD?

To be clear, I said "In F#, we tend not to use an object-relational mapper (ORM)" but not because of any validation issues, rather because a big ORM like Entity Framework is heavily object-oriented (...
Grundoon's user avatar
  • 426
7 votes
Accepted

What is the term for different types that contain the same information?

Let's start with Type3 and Type4. I assume that the "lossless" mapping you have in mind is the library function toList. This will just map a Map to a corresponding List containing all key / value ...
Giorgio's user avatar
  • 19.7k
6 votes
Accepted

List asymetry in F#

because a cons lists are inherently asymmetric a :: b :: c :: [] is actually a :: (b :: (c :: [])) getting at the first/head is an O(1) operation getting at the last item is O(n) and if the list ...
jk.'s user avatar
  • 10.3k
6 votes
Accepted

Why the name MailboxProcessor in F#?

"Mailbox" is a standard term in message passing concurrency. A mailbox is where the messages are delivered to. It's basically an older and more widely-used synonym for "message queue". It is also ...
Jörg W Mittag's user avatar
6 votes
Accepted

Why does FSharpLint suggest, "In F# code, use 'e1 || e2' instead of 'e1 or e2'"

According to the FSharpLint folks, it's not a Lint warning; it's a warning emitted by the F# compiler. It's probably there because or doesn't have a corresponding and counterpart. There is an and ...
Robert Harvey's user avatar
5 votes

Should function composition and piping be tested?

What would be the value of testing when it's harder to read than the production code? When unit testing we do not verify code, we verify behavior. We are doing it for two reasons: Document the ...
Timothy Truckle's user avatar
5 votes
Accepted

Is the "_" character in the first anonymous function a wildcard?

is the _ in the function called by Seq.initInfinite a wild card Yes. so that anything can be read off STDIN No. Seq.initInfinite passes an int, indicating the current index. For example, you can ...
svick's user avatar
  • 10.1k
4 votes

REPL-based Workflow and Unit Testing

Read-Eval-Print Loop (REPL) development should be concerned with "growing" usable functions. Unit testing should be concerned with testing those functions to make sure they work properly. There's ...
Robert Harvey's user avatar
4 votes

How/if to test basic combinations of already tested functions

As you stated, it is easy to forget a filter function in the list and this error would be hard to detect in later tests. This means that you really should write tests for applyOrderFilter. The tests ...
Bart van Ingen Schenau's user avatar
3 votes
Accepted

FP Free Monad vs OOP Dependency Injection

Mostly what free monads are in relation to an onion architecture are a way to easily swap the outer layers of the onion. In practice, usually you swap in a pure interpreter implementation for unit ...
Karl Bielefeldt's user avatar
3 votes

F# DDD Bank Modelisation: Aggregate Design for Event Sourcing

Adding to the existing comments and answers, I would also suggest that you can use interfaces to abstract semantically equivalent concepts from different concrete types. For example, you may have ...
Aaron M. Eshbach's user avatar
3 votes

F# DDD Bank Modelisation: Aggregate Design for Event Sourcing

Personally, I do think that the main goal of DDD is to make code communicate the same language as domain experts do thus easing the mental burden of mapping actual business domain to your code. That'...
Bohdan Stupak's user avatar
3 votes
Accepted

How/if to test basic combinations of already tested functions

Kent Beck: I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high ...
VoiceOfUnreason's user avatar
2 votes

Is the "_" character in the first anonymous function a wildcard?

"Don't care" underscore identifiers are effectively used as wildcard patterns. The difference with a variable that would happen to be named _ is that each occurrence of _ represents a different ...
coredump's user avatar
  • 5,965
2 votes

Why not use an ORM with DDD?

If you read the next paragraph in the book, it says this: What's special about using a type provider rather than a typical runtime library is that the SQL type provider will create types that match ...
Robert Harvey's user avatar
2 votes

What are the biggest differences between F# and Scala?

this is also a good article on the topic: comparing-scala-to-fsharp as always, best way is to try for yourself! //dotnet fsi --> starts F# interactive //or open vscode and a .fsx file, install ...
jkone27's user avatar
  • 39
2 votes
Accepted

F# function like reduce that return different type

You are probably looking for fold. The main caveat with a fold is it requires you to provide an initial value for the output, instead of using the first element, but this is usually what you want when ...
Karl Bielefeldt's user avatar
2 votes

Generic method with different arguments

Use generics here to create true type safety, as that is what generics are for after all: ILogicClass<T1, T2> object = factory.GetByRequirements<T1, T2>(reqs); output = object.GetResults(...
David Arno's user avatar
  • 39.4k
1 vote

Private types, units of measure when is it a good idea?

A date is a point in time (year, month etc. or seconds from a starting point). It is changed from and to text for display purposes. A duration is measured in seconds. You can change it to and from ...
gnasher729's user avatar
  • 45.9k
1 vote

Functional Approaches to Serializing Objects to Variable-length Byte Array Output

Pickler combinators are what you could call the functional approach to serialization. Here's a link to a seminal paper by Andrew J. Kennedy that describes them. There's a number of implementations of ...
scrwtp's user avatar
  • 4,532
1 vote
Accepted

F# - Associating a function with the matching type of object

Second approach is the best. First approach admits invalid data - i.e. you can put any function in place of PawnData.Pathfinder, and there is no way to enforce that it's a valid one. Third ...
Fyodor Soikin's user avatar
1 vote

wooden floor seam staggering algorithm

I can give you a very general algorithm useful for these types of problems. This algorithm is mainly useful for your specific problem because you have a relatively small search space. If your search ...
Frank Hileman's user avatar
1 vote

Best way to handle language interoperability

One of the issues is programming to a model. The other issue is programming to a machine. So you can program to a model and create an intermediate compilation that maintains any kind of special ...
Yemi Bedu's user avatar
  • 111

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