You have a good point there, that is better. But it is still, well honestly, wrong. Two orders ordered at different times are just not the same order, and using a typeclass approach to say that they most definitely are is going to bite you in the back seat.
PartialEq and Eq for PizzaDetails is good. If there is a business function that computes whether or not someone orders the same thing, then that should start by projecting the details.
Yeah, I immediately twitched when I saw the PartialEq implementation. Somebody is going to write code which finds the "correct" order and ends up allowing someone to order the same pizza but get yours, while you have to wait for it to be made and cooked again.
It's not difficult to write the predicate same_details_as() and then it's obvious to reviewers if that's what we meant and discourages weird ad-hoc code which might stop working when the PizzaDetails is redefined.
I do agree that implementing PartialEq on orders in this way is a bad fit. But it is a synthetic example to make a point, so I tried to keep it in the spirit of the original article (while ironically picking nits in the same vein myself).
I think that a big problem here is the fact that in OOP, everything is an object, i.e.: a class. And if all you have is a hammer, then .... But it is much better to picture the model, controller and the view as emergent. But implementing this in OOP is too challenging because some things in either of those three domains are going to be a process, or a piece of state or a role, etc.
And in implementing some process, what is it? As in: what is its encoding in $language and where does it go?
So you end up with the local stamp collectors in the office and get into an argument of: it is part of the model, so should be in the Model class. "Process, nah, that is totally a controller aspect. It does something." etc.
You both have good points. But there is monads the mathematical and programmatic concept, and there is also something a little bit handwavy in how these things are incorporated into an application architecture. The latter is what is being used on the one hand in comparison to MVC, etc, on the other.
I.e.: a monadic architecture in Haskell is good, but one in Java is going to suck. A sort of half-way point is in The Elm Architecture, which is a sort of deconstructed IO monad.
(Writing this as someone with decades of experience in writing monadic architectures.)
> I am going to interpret your question as one asked in good spirit.
Thanks. It was.
> I like this book
I have that book, but I haven't read it. Which part specifically should I look at to understand what you mean by "monadic architecture"? Or do I need to read the entire book first? I'm searching through that book right now, and as far as I can tell, it doesn't mention "monadic architecture" even once.
That doesn't really tell me anything though. I use monads, and applicatives, and functors, and monoids, semigroups, etc…
When you use Hakyll to generate a static site, you use a bunch of monads. But is a Hakyll site a "monadic architecture"? I'm not quite sure how I'd describe it as an architecture — it's really just an imperative program. It's to some degree a bit like a Makefile.
A Yesod application on the other hand I would readily describe as MVC, and yet it's all monads all over the place.
What about something like The Elm Architecture? Elm provides a bunch of monads (not directly as an abstraction, but through a few specific instances) but its architecture I would describe as perhaps FRP, or unidirectional data flow state machine kinda thing.
So that's three examples with clearly distinct architectures, and all three are architectures that "consist of monads".
So, I don't really understand what "monadic architecture" means.
I don’t really understand what a “monadic architecture” is supposed to mean.
Haskell’s `Monad` type class is hardly the only possible encoding of a monad. They’re just a simple mathematical construction with useful properties, and — like functors and applicative functors — they emerge everywhere.
See, I don't think you don't really understand my point. I said this elsewhere: I have been programming Scala and Haskell for more than 15 years, which I am sure you have as well. This is not ment as a proof of my point as that would be arguing form authority. This is not my intention. But there are more things at play here.
What I think you are doing is: well quantum mechanics is just simple mathematical construction and some artithmetic.
F# is a wonderful language, one that I write as my daily for the second time during my carrier. It _baffles_ me how it isn't more popular than it is because it truly is very very good. And I say this as an experienced and avid functional programmer.
We even do the frontend in it using Fable and Elmish, which is to say: we basically write our frontends in Elm, but the platform is .NET.
My own functional programming language. I'd done an imperative before but wanted one that has pattern matching, would let me do currying _and_ uses a bidirectional type-checker. All of this is currently implemented but not for all type constructs. It's name? Marmelade. Because Lady Marmelade and thus files with a lady suffix. m.lady.
We can use the privatisation of water in the UK as a case study.
The water companies in regions across the UK were privatised.
Lots of big international companies borrowed lots of money to buy these companies.
The water companies then borrowed large amounts of money, secured against their ability to extract rent from their customers, and the owners used that money to pay of the debt they had incurred in buying the water company, and also paid it as dividends.
So basically the debt burden moved from the buyers to the company they had brought. Neat!
Now a couple of decades later you have these water companies with silly amounts of debt, the technical debt of not maintaining and investing in the infrastructure (they keep blaming the Victorians, but that is just blame spin) and an owner who would be happy to cut ties and let the water company flounder to be rescued by the taxpayer...
You are derailing my question above with a whataboutism here and I am being downvoted for pointing that out.
There are problems with a lot of things in the world, for instance the rentier economy you mention here. But I don't owe anyone a solution to that just because I want to know which privatisations are the cause of the Swedish energy production and price crisis.
Can anyone name a public utility that was privatised in western Europe and for which a clear case can be made that it was a good thing to do (from the perspective of the country and the public)?
The problem is that transferring energy like that requires both lines and the ability to receive the energy. Transferring has (large) energy losses, the ability to receive requires a large inertial mass, like the large and heavy turbines of the nuclear power plants.
There are/ were plans for a number of different power links, but some of them have been denied because of environmental concerns (I think! please correct me on that.)
This is the answer. It's not as simple as just laying down more cable, and it was a really hard self-own to shut down the nuclear plants in the south without anything to cover for them.
What is gained by preventing the company from accepting more money than your revenue cap? It would be bad for everyone. What are you trying to optimise?
Oh, misunderstood. You still need to think about what it is you wish to optimise for. I am not a regulation hater but naive regulations tend to cause rather than mitigate pathological economic incentives. It is very very hard to get these kinds of things right.
Another thing, one related to your original post: it is, of course, good imho to have a working hand-out system so that you don't starve when you are out of a job, or are forced to have to work for really shitty conditions.
This causes another problem, however. It is very easy to get dependant on these hand-outs because the difference in pay between the jobs you are able to do and the size of the hand-out can be very small. Even negative. We have (had) this problem in Sweden for a long time. And it is a problem because when people are less poor, then things cost more money because of it. Cynical, I know. Economics is very very hard.
I’m optimising for concentration of ownership. So if you allow a privately held company to get too valuable it’s harder to enforce against concentration of ownership, much easier to do with a publicly traded company IMHO.
In relation to your concerns about a job guarantee they’re all addressed in writing, in particular by Pavlina Tcherneva who has done the most comprehensive work on the subject along with Bill Mitchell and Randall Wray. It should be noted that I disagree with Bill Mitchell on some political issues but his JG work is rock solid.
This is not a good explanation without also looking at who is unemployed. In Sweden, the unemployment is low:ish but it is basically non-existent with the natives, but very high among immigrants. So it might be true that crime correlates with unemployment rates, but Sweden does not have a high unemployment.
Canada has a much higher middle Eastern population than Sweden. Canada does not have a middle Eastern crime problem nor a middle Eastern unemployment problem.
I imagine the biggest difference is that the core of this group has been in Canada for almost 50 years.
PartialEq and Eq for PizzaDetails is good. If there is a business function that computes whether or not someone orders the same thing, then that should start by projecting the details.
reply