TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

What Can You Put in a Refrigerator?

122 点作者 rnicholson超过 9 年前

22 条评论

TeMPOraL超过 9 年前
The more I have to deal with corporate project management patterns, the more I think the whole approach behind specifications is wrong. Trying to focus on what the &quot;domain objects&quot; are and what is their flow is pointless, especially if you&#x27;re dealing with real-world objects (like the fridge from TFA). You can model <i>something</i> this way, but it will be usually the imaginary perfect path, a narrow vision of how things <i>should</i> be done, that will break on first contact with the real world - a world that is messy and requires humans to improvise on the spot.<p>I&#x27;m starting to believe that one should focus on the workflow instead. After all, the reason for writing software as a tool is to simplify or automate some existing process. So focus on what people are already doing and what they&#x27;re trying to achieve and find a way to remove repetitions, unnecessary delays, etc. Just look on what people are doing and find a way to do some parts of the process faster and better.
评论 #10567810 未加载
评论 #10567397 未加载
hapless超过 9 年前
The original spec, &quot;Anything that fits into a refrigerator,&quot; is a pretty darn good one. It conforms to Postel&#x27;s law: &quot;Be conservative in what you do, be liberal in what you accept from others&quot;.<p>We can develop a spec in a vacuum, but we can&#x27;t be sure what users actually want from our refrigerator. Maybe a live penguin actually <i>does</i> belong in there, as in the famous children&#x27;s novel.
评论 #10567150 未加载
评论 #10567138 未加载
评论 #10567262 未加载
miguelrochefort超过 9 年前
&quot;Any contained item that can fit inside a refrigerator, whose quality would degrade significantly more when kept at room temperature rather than at 1-4°C, by the estimated time of use&#x2F;consumption.&quot;<p>The term &quot;contained&quot; above is restrictive, and probably needs further precision. Only things that thrive inside an opaque and sealed container would fit the definition above. Otherwise, things that can affect the quality of other items (i.e., gas emanation), things that need light, things that need oxygen, things that need a specific range of moisture, things that can grow and&#x2F;or move, would all need their containers to provide these conditions and&#x2F;or have a dedicated location inside the refrigerator.
评论 #10567053 未加载
评论 #10566818 未加载
评论 #10566955 未加载
评论 #10567998 未加载
评论 #10567303 未加载
sparkie超过 9 年前
Anything the user decides to put in the refrigerator, provided we put warnings in small text on the document that accompanies the refrigerator for catogories of items we know to be unfit for the refrigerator so as to cover our asses if the user does not heed our warnings.<p>In terms of software, trying to decide up front for the user what they can do is the wrong approach. Even constraining them is flawed, with the exception of constraints for liability issues. What the user needs is the meas to express their decision making as to whether something should go into the fridge, so they need an input mechanism capable of doing selection, which has access to the context in which the item might be being placed into the fridge.<p>Does this sound like any configuration format you&#x27;ve ever used? The typical key-value stores which attempt to give you a declarative list of what you can put where, without the means to compute whether or not it might be a good idea first are almost ubiquitous, and the number of programs which take the right approach: give the user a proper, expressive programming language to configure the software, are few.<p>Just as it happens, we&#x27;ve developed ACME Refrigerator v2.0, which now allows you to store chocolate bars in it; a feature we missed in v1.0. Upgrade now for just $400.<p>The absurity of this idea with a fridge seems lost in software because we can upgrade at almost zero cost in just a few minutes, but that&#x27;s only masking what is an obvious design flaw.<p>Which raises the question: What can you put in a software package definition?
jtheory超过 9 年前
Fun read. This reminds me of how &quot;object-oriented&quot; programming goes wrong for beginners. ...Not helped, alas, by all of the texts that thing it&#x27;s helpful to demonstrate OO concepts by modeling things like &quot;cat is a subclass of animal&quot; :&#x2F;
评论 #10567988 未加载
CapitalistCartr超过 9 年前
This essay assumes the wrong answer. The intelligence has to be built into the item, not the appliance, just as we do now. Packages have messages such as &quot;Refrigerate after opening&quot; on them. Anything that needs to be refrigerated will need to communicate that need, along with details such as temp, to the automated system.
评论 #10566824 未加载
评论 #10566446 未加载
评论 #10566520 未加载
评论 #10566507 未加载
评论 #10567668 未加载
评论 #10566419 未加载
Symbiote超过 9 年前
The question is wrong, as it stands the answer is &quot;any non-fluid or contained fluid that will fit&quot;.<p>&quot;What should one store in a refrigerator?&quot; is a better question.
评论 #10566555 未加载
评论 #10566787 未加载
评论 #10566557 未加载
farhanpatel超过 9 年前
It reminds me of this &quot;What is a Photocopier?&quot;<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=PZbqAMEwtOE" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=PZbqAMEwtOE</a>
zombees超过 9 年前
&quot;Anything that fits in the refrigerator and will remain contained within it.&quot; Covers all uses for refrigerators and prevents anyone from putting bulk liquids, penguins, coyotes, live hand grenades, radioactive material, nuclear weapons or Indiana Jones inside.
评论 #10566805 未加载
mikepalmer超过 9 年前
Reminds me of a question I have been wondering about: Can you formally specify what is the purpose of a suitcase?<p>In principle, you could dump all your clothes, toiletries, etc. in a pile on the airport checkin counter, and if system were organized enough, it could deliver all your stuff to hawaii and lay it all out on the hotel bed for you.<p>E.g., a robot would scan all your belongings at the airport, and dump them all into a big pipe... each item would get properly routed to your hotel room... kinda like how the internets work!<p>Is it just a question of organization? &quot;Everything in this suitcase belongs to this person and should move together to the same destination.&quot;
评论 #10566970 未加载
评论 #10566977 未加载
pheroden超过 9 年前
Bacon, cheese, steak, and bottled beer. Being single sure makes writing specs easier.
评论 #10566910 未加载
platz超过 9 年前
I think this is hinting at the problem that occurs in OOP, when the business rules of the system are expressed with virtual methods in classes as part of an inheritance chain, in the business domain<p>Example: eric lippert tries to model an RPG in OOP and tries to model the character &quot;uses&quot; command: <a href="http:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;11&#x2F;wizards-and-warriors-part-five&#x2F;" rel="nofollow">http:&#x2F;&#x2F;ericlippert.com&#x2F;2015&#x2F;05&#x2F;11&#x2F;wizards-and-warriors-part-...</a>
Sniffnoy超过 9 年前
Anything that you can fit in and that you can also easily get out again.<p>(The latter requirement rules out not only liquids but also e.g. a pile of salt or rice.)
评论 #10567675 未加载
chetatkinsdiet超过 9 年前
If this is how you&#x27;re defining requirements for software or new product creation you&#x27;re doing it wrong.<p>The goal should never be to describe every single outcome or scenario- the goal should be to build understanding between business&#x2F;product&#x2F;development team so that they understand the point of the work that the software replaces. It&#x27;s no different with hardware or really any new product creation. The goal is to create a conversation that gets us to solving the problem- when the spec gets to covering all cases the chances we get this wrong and stray from solving the actual problem goes up massively.
评论 #10567199 未加载
slicktux超过 9 年前
I say we make a refrigerator library; then anyone can define a refrigerator within the library; then we can call the function and apply it to out arbitrary needs. #include &lt;refrigerator.h&gt;
评论 #10567028 未加载
mobiuscog超过 9 年前
Amazing how many people try to create a specification without knowing the problem.<p>A specification should be for a solution to a problem - &quot;We need a way to keep xxxxx cool&quot;. That problem defines what needs to go into the refrigerator from the outset.<p>What&#x27;s the actual problem space here ?
peter303超过 9 年前
You can sometimes explain better by a set of examples rather than an explicit categorical description. The base set of examples I started with is what my mother put in her refrigerator.
1amzave超过 9 年前
I&#x27;m reminded of an excellent quote from Bertrand Russell:<p>&quot;Everything is vague to a degree you do not realize till you have tried to make it precise.&quot;
pravj超过 9 年前
cream, mayonnaise, ketchup, soda and PAPER, SNOW, A GHOST.<p>- Joey Tribbiani, Friends episode 10.11
dmourati超过 9 年前
The penguin line made me lol.
Jacoby6000超过 9 年前
I&#x27;m going to repost something I had said in response to this article on another site. I think it&#x27;s an awesome example of what can happen when you create a language with extensibility in mind.<p>-------------------<p>Scala solves this problem really well with typeclasses.<p>You can define a typeclass like<p><pre><code> case class Refrigerated[T](thing: T) &#x2F;&#x2F; this is just something holding things that have been refrigerated. trait Refrigeratable[T] { &#x2F;&#x2F; this is the typeclass def refrigerate(thing: T): Refrigerated[T] } </code></pre> Now we have a refrigerated object that holds some object that&#x27;s been refrigerated, and it looks like I&#x27;m about to do some class composition, but I&#x27;m not. Bear with me.<p>Now, we have some sort of data class<p><pre><code> case class Pillow(fluffiness: Int, warmness: Int) </code></pre> Pretty straight forward, we now have a Pillow with measurable fluffiness and warmth<p>Next, lets implement refrigerated for pillow.<p><pre><code> implicit val pillowRefrigerable: Refrigerable[Pillow] = new Refrigerable[Pillow] { def refrigerate(pillow: Pillow): Refrigerated[T] = Refrigerated(pillow.copy(warmness = pillow.warmness &#x2F; 2)) } </code></pre> So there&#x27;s an implementation of Refrigerable for pillow. Refrigerating a pillow just cuts the warmness in half.<p>So actually using the Refrigerable stuff. There&#x27;s two ways to go about this. One way is to just use the Refrigerable instance to refrigerate the pillow.<p><pre><code> def refrigeratePillow(pillow: Pillow): Refrigerated[Pillow] = pillowRefrigerable.refrigerate(pillow) </code></pre> Nothing special there. You could basically do that in any language. So how does scala do it better? Well, we can define a refrigerate method for anything Refrigerable like this:<p><pre><code> def refrigerate[T](thing: T)(implicit refrigerableInstance: Refrigerable[T]): Refrigerated[T] = refrigerableInstance.refrigerate(thing) </code></pre> Now this is really cool. Anything type that we have a Refrigerable instance for, can be used as an argument for refrigerate. And we don&#x27;t have to explicitly state what Refrigerable instance we&#x27;re using. Calling it looks like<p><pre><code> val refrigeratedThing = refrigerate(anythingWithARefrigerableInstanceHere) </code></pre> Okay. We still haven&#x27;t gained a whole lot. All we&#x27;ve done so far, is make it so we don&#x27;t have to explicitly state what Refrigerable to use. So let&#x27;s go an extra step. Let&#x27;s make it so we just call refrigerate on the Object itself rather than passing the object as an argument to a method. This is possible, because scala let&#x27;s us make extension methods for generics.<p><pre><code> implicit class RefrigerableOps[T](thing: T)(implicit refrigerableInstance: Refrigerable[T]) { def refrigerate: Refrigerated[T] = refrigerableInstance.refrigerate(thing) } </code></pre> Okay, now this is really cool. We&#x27;ve defined a method for any type for which we have Refrigerable in scope. This means we can now refrigerate our pillow more easily:<p><pre><code> val refrigeratedPillow = myPillow.refrigerate </code></pre> What?! That&#x27;s great! And it gets better. Now that we&#x27;ve implemented this boilerplate, giving other things this wonderful syntax is easy. Let&#x27;s say I want to refrigerate my cousin, because she&#x27;s too hot.<p><pre><code> case class Cousin(hotness: Int) implicit val refrigerableCousin: Refrigerable[Cousin] = new Refrigerable[Cousin] { def refrigerate(cousin: Cousin) = Refrigerated(cousin.copy(hotness = cousin.hotness - 1)) } </code></pre> Now we can make our cousin less hot! Great!<p><pre><code> val refrigeratedCousin = cousin.refrigerate </code></pre> This is basically a good way to make things open to extension without subclassing it&#x27;s awesome!<p>You can even do more to simplify making the Refrigerable instances. You can effectively make them one liners.
pvaldes超过 9 年前
A porpoise