8,634 karma · joined Jun 23, 2011 (15y ago) · 7,679 submissions
comment 2y ago · link · parent
Why not? You're asking a question, of sorts, and getting an answer from the result. That's the literal definition of querying.
> Grabbing all the docs in the db into my controller and filtering down that array is what Firebase makes me do instead of writing queries.
A query language is just an abstraction. One you can have in your code. At some point you still need to "grab all the docs into a controller and filter them down", though. You could push that step into the Firebase service, but it would still have to do the same thing you're doing. There is no magic.
Better would be to provide something indexable so that you don't have to go through all the docs, but you can't index that which does not exist.
comment 2y ago · link · parent
Whether or not that is true, why would they care? They'll be gone.
> Agile's focus on delivering high-quality, useful, and timely, product to end-users.
I tend to agree. As managers are removed from the picture, there is no manager to hide behind. You're working directly, each day, with those who are going to hold you accountable.
> We need more examples of the Agile process doing really good work.
To be fair to the managers, are there any? Even the C3 project that gave birth to Agile is widely regarded as a failure.
comment 2y ago · link · parent
Seems the biggest problem is that Firebase doesn't have relations. How can you query that which does not exist?
I'm guessing what they really want is SQL? Once upon a time when I was stuck on a Firebase project I built a SQL (subset) engine for Firebase to gain that myself, so I expect that is it.
comment 2y ago · link · parent
Funnily enough, that fact alone might be enough to reverse course!
What we see over and over and over and over again throughout history is that the rich will do something that stands out and then the poor will try their best to emulate it; seemingly stemming from a subconscious (and perhaps sometimes conscious) "That must be why they are rich. If I do the same, I will become rich too!"
In fact, I would argue that the fertility situation is just another example of that. When the rich were able to start choosing to not have children, they did, and the poor have been trying to do the same ever since. As suggested in earlier comments, it is quite clear that the no children/few children movement started with the rich, and now is working its way through the entire population. Like you imply, perhaps unintentionally, it has become assumed in our culture that the rich are rich because they don't have children. To the point that we see a lot of messaging towards our youth along the lines of "What about your education? Having children is throwing your future away."
However, as we reach the long tail of the poor no longer having children, there is a pretty good chance that the rich will start having children again because they can – as a display of their opulence. Should that take hold, the poor will try everything they can to follow suit. They always do. And then... Problem solved.
comment 2y ago · link · parent
Right, and that reason is because there is a market for testing tool waters to see if it is a tool that you even need. Often you cannot truly appreciate if a tool is a tool you should have before trying it. You can read testimonials from other people all day, every day, but until it is actually in your hand...
So, hypothetically, do you buy the $100 version with clear compromise, but good enough to offer some validation, or go for the $1,000 ultimate version from the hop? That's the gamble. If your assumption was right, you're in deep for $1,100, but if your assumption proves wrong, you're only out $100. That's the idea here. When in doubt, try the cheap tool, and when you're still wanting to use it beyond its constraints, you've proven you need the more premium product. If you leave it sitting on the shelf, now you know you don't need the tool at all.
As with all short-soundbite suggestions, it's not meant to apply to all situations. But in the average case, it is likely that you are better off gambling the hypothetical $100 – especially when the undertone is within a hobby context. It is very likely you will discover you didn't really like the hobby anyway. Of course, as always, it is assumed you will still bring your thinking cap to the table. Indeed, there are situations where going straight to the hypothetical $1,000 tool is the right choice, but the saying is merely pointing out that it isn't always the best choice like some people are inclined to believe.
comment 2y ago · link · parent
Sure, same as any other language with duck typing. Consider Ruby, which is famous for its duck typing. `variable.not_a_method` raises NoMethodError. How do you think it knows to do that? That's right, it first performs a type check and, since that check fails, it doesn't try to call the method and instead raises the exception. Exactly the same as Go panicking under the same circumstances.
> and then to something with a specific interface.
That is a type assertion, not a cast (Go doesn't have support for casts anyway). It merely asks the runtime: "Does this value satisfy the given type?" There is no change in type.
Now, let's take this further: It is generally agreed upon that duck typing differs from structural typing only in that it is evaluated dynamically instead of statically. Go's interface is quite clearly a structural type when evaluated statically.
And what do you think the type assertion does in the example given? That's right: It performs a type assertion on a "structural type" at run time. Duck typing, by definition!
> I don;t consider C a duck typing language too, because you can write ((Bird) ptr)->swim(), but perhaps you do?*
No. First and foremost, where would the typing come into play? That will actually try to call the method, whether the pointed memory is suitable or not. There is no type checking to steer you around mistakenly calling something that shouldn't be called. Not at compile time, not at run time.
It is literally called duck typing, not duck valuing. "Type" has significance. Where do you find it here?
comment 2y ago · link · parent
Now, my six year old could definitely handle the work of my employees making $60-80k per year, legalities aside. If we stick with the social norm of 18 years of the child being an extension of the parent, that is 12 years of gains. If I recall, the cost to support a child is $4,000 per year[1], so let's say after 12 years one child will pay out $672,000[2]. $2MM from all three children.
That's a $500,000 payday ($2MM less the $1.5MM opportunity cost) by the time your children have left the nest, or, as the universities like to calculate it, $8MM in additional lifetime earnings. I am quite certain that if you told would-be parents that they stand to gain a $8MM by having three children they would take notice!
Trouble is, in rich countries that is unquestionably considered amoral, and is no doubt illegal. Without that changing, it is, indeed, hard to realize the benefit. But, by the same token, if you forced the people into poverty without a change in those legal and social norms, they're still not going to be able to realize the benefit. It is not poverty itself that is significant.
[1] You will probably be more familiar with a figure around $13,000, but you will notice that it factors in things like the cost of housing, etc. While it is not unreasonable to include those things in certain contexts, for the sake of this discussion it would not be an additional cost. You're probably not venturing into the woods and living under the leaves if you don't have children. The housing cost is there with or without them.
[2] It is more complicated than that, I know. But, for the sake of illustration let's run with it.
comment 2y ago · link · parent
So close, yet so far. The actual solution is to allow children to be a tangible benefit to parents.
Those in impoverished countries have more children, not because of poverty itself, but because poverty means they have strong incentive to put the children to work and reap the benefits of that labour. Children make them richer (not rich, but richer than they would be without children). In our society, children generally make the parents poorer. To the point that "think tanks" love to make it known exactly how much poorer a family can expect to be.
Forcing the first world into poverty, but without changing laws and other social norms, wouldn't make much difference as the children would still be left to be useless lumps who do nothing but sit around in a school all day. Who wants to produce a useless lump? And if you do for some reason, your backyard woodworking shop is just as good at producing useless lumps at a fraction of the cost.
comment 2y ago · link · parent
Before LLMs you'd probably have to reach for learning Python or Javascript sooner, at least if StackOverflow didn't have the right code for you to copy/paste, but I expect anyone who sticks with it will get there eventually either way.
comment 2y ago · link · parent
Indeed – and for good reason, I'm sure. Pedantically, a cast is where the programmer says in a language "just trust me on what type this is, don't bother to check my claim". A runtime type cast doesn't make any sense.
I mean, I'm fine with words evolving and whatnot. I'm not here actually trying to play language police myself. But, as it seems you want to squabble over "duck type", which is then quite humorous when you accept any random definition someone can dream up for "cast": Why not call what Java is doing duck typing?
> I hope you would agree they are essentially the same.
I do agree, just as I said before, that Go's type conversions are essentially the same, except checked at compile time rather than run time. There is no conversion with type assertions, however. It is merely a runtime type check. The type you have is the type you keep.
Now, what is important to remember is that Go's interface is a structural type. And what is a "structural type" checked at run time? That's right: A duck type!
> So TFA could be written in any of those languages
It's all just 1s and 0s at the end of the day. Of course you can write something that achieves the same result in just about any language. There is more nuance at play here, though. In the case of Go, it is not "here is another way to achieve the same thing". It literally employs duck typing, as duck typing is normally understood.
comment 2y ago · link · parent
The structural/duck typing thing is exactly about when the type check happens. That is the thing that makes them different. We aren't just throwing out random words. We would not be talking about them in the first place if not for that fact. To say it is not about the only reason we have for talking about them is... strange.
> My original point was that TFA doesn't really feature duck/structural typing
It does, indeed. It demonstrates both, in fact. Go uses nominal typing for everything but interfaces. Is that the source your confusion?
> the example program just shows dynamic upcasting/downcasting
I know we threw casting around loosely to not confuse the contextual parent, but if you look closely, Go doesn't even support casting at all. And this isn't type conversion either. Go uses the syntax `type(variable)` for that. This really has nothing to do with what was seen in the article; it was doing something quite different.
To be fair, I'm not sure you have demonstrated that Java has casting either. What you wrote appears to be much more like type conversion, except type conversion is checked statically, while yours was checked at runtime. Frankly, I have never heard of a term for what you have shown, so I don't know what to call it. I suppose casting, overloaded with new meaning, really is that term[1]? Go doesn't support casting in that sense either, though.
[1] Which, if that is the case, would make the rest of this thread quite hilarious with your attempt to be the language police for "duck type", yet being accepting of any arbitrary use of "cast".
comment 2y ago · link · parent
The difference between structural typing and duck typing is that one is evaluated at compile time, while the other at runtime. Typescript is erased before runtime, so it by itself does not exhibit duck typing features, although Javascript does.
comment 2y ago · link · parent
'If' being the operative word. You're not actually casting. That was merely to not try and confuse the commenter further. In fact, Go doesn't even support casting! It does support type conversion, which is oft confused with casting, but that uses the syntax `type(variable)`, which is not what is going on here either.
> In reality there is no interface tying the methods together, and the whole thing is done at runtime, along with a runtime error if the method doesn't exist.
Right, which is how it works.
comment 2y ago · link · parent
While you are free to make up any definition you want on the spot, so are others. Yes, language models are just plain old boring machine learning like any other, but machine learning is a subset of what most people consider to be the area of AI.
> When we get actual AI (not counting on anytime soon) it will be more than the annoyed developer that loses their job
Again, while you can define things however you please, so can everyone else. This is what most people would consider AGI, not AI.
comment 2y ago · link · parent
That doesn't make sense. Not having to write "implements IDuck" is true of both structural typing and duck typing. That logically cannot be what makes them different.
comment 2y ago · link · parent
Maybe. I don't have a language reference handy. Does runtime type checking take place with that code?
My impression, based on the way you said it (and my vague memories of using Java once upon a time), is no. On that assumption, where would you find the duck type? The significance of both structural typing and duck typing is that type checking occurs. As before, the difference is when the check takes place – be it at compile time or at runtime.
Perhaps you could update that code to demonstrate how you would bypass calling objects which, when type checked, show to not quack like a duck like as is shown in the Go examples?
comment 2y ago · link · parent
Not cast to just a concrete type, but to an interface. Literally duck typing.
> then you'd get a compile-time error.
Which is emblematic of structural typing, and the only real difference between structural typing and duck typing is that one is dealt with at compile time and the other at runtime. The article tells that Go supports both.