Skip to content

Commit 1f186be

Browse files
committed
refactor: hide unreadable linq behind a more expressive extension method
1 parent c4b4060 commit 1f186be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@ The callback principle, pass `OperationB` as an argument to `OperationA` and let
7676
- Gap between the semantics of the requirement to find the cheapest painter and the original implementation using looping and branching.
7777
- Problem: Given a sequence of N elements, find the best fitting one.
7878
- Bad idea: Sorting - sort the sequence and pick the first element. Yields `O(NlogN)` where N is the length of the sequence.
79+
- OrderBy(x => {}).First() invokes the predicate for each element of the sequence
7980
- Better idea: Picking - Yields `O(N)` and execution time should be proportional to the length of the sequence.
81+
- Aggregate() walks the sequence once
82+
- Loops and branching instructions are infrastructure. Don't deal with infrastructure, deal with functional requirements.
83+
- Pick an available painter with the minimum estimate cost.

0 commit comments

Comments
 (0)