|
I concur.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
C# sort of has it too, with deconstructing:
Deconstructing tuples and other types | Microsoft Docs[^]
It's quick and easy to do with tuples, but you can add any number of Deconstruct methods to a class as well. I see destructuring (in any language) as another tool in your toolbox that can be helpful if used judiciously. Of course, that depends on people having good taste and knowing when to use something, and when not to.
I also find it mildly amusing that every language seems to be slowly implementing features Common Lisp had decades ago - destructuring bind, in this case. I'm convinced that Lisp programmers are playing the long game and aiming to achieve ultimate victory by very gradually changing every programming language into Lisp. Maybe some variant of Greenspun's Tenth Rule in action here.
|
|
|
|
|
Ryan Peden wrote: Of course, that depends on people having good taste and knowing when to use something, and when not to
Agree 100% and that really is my point. These new features are really great when used at the appropriate time. I just see that now in many cases all programming is becoming these bits and pieces type of things and many newer devs think this is correct.
A Training / Teaching Problem, Really
It is most likely the fault of the training and not the language, of course.
It's just becoming quite pervasive and I believe is leading to a lot of crapware that does a few things right, looks shiny but then has bugs that no one can find because the maintenance is a nightmare.
Ryan Peden wrote: every language seems to be slowly implementing features Common Lisp had decades ago
That's fantastic you mentioned that, because I often mention this new functional-type aspects of new languages and people mention old languages had this already. I believe it. Again, I think these new things are great. It's just that they are so often meant to be used 20% of the time and instead they are implemented 98% of the time.
Great discussion.
|
|
|
|
|
Yeah, exactly. Every feature needs to be used responsibly.
It's like...when I was a child, I loved grape Kool-Aid. It was tasty and fun. I would have happily drank a gallon of it per day. But the adults in my life wouldn't let me.
Now that I'm an adult, I could drink a gallon of Kool-Aid every day, because nobody would stop me. But I don't, because I'm not crazy. Everything in moderation, right?
But with features like destructuring, some developers don't have that sense of moderation. They think that since you can destructure, you should destructure everything. Heck, now that I think about it, maybe they are sitting there guzzling grape Kool-Aid as they destructure every second line of their JS. If you're going to go overboard you may as well go all-in.
And you're right - it's funny how most new features are really that new at all. Maybe if we had all learned from Perl, developers would be cognizant of the horrors of destructuring run amok and be a little more hesitant to pull it out of their JS toolbox too often.
|
|
|
|
|
I see your deconstructing and raise you var . I die a little inside every time I see C# code that looks like Javascript. var was meant for implicit typing of generated types without accessible symbols (e.g. anonymous types).
|
|
|
|
|
I love var and auto
*hides*
*peeks out*
I hate duck typed languages though
Real programmers use butterflies
|
|
|
|
|
We've all got a little inconsistency in us. I like Typescript but despise raw Javascript.
|
|
|
|
|
I agree with you about typescript. I actually think it's kind of refreshing to have hard types over the top of JS.
It almost makes me want to use it. I may have to soon as I'm about to code a VS Code extension (bless VS Code)
Real programmers use butterflies
|
|
|
|
|
Oh cool. I recently (last 6-ish months) started using VS Code. I really like it so far.
|
|
|
|
|
It has finally replaced visual studio for me, but then i've been doing a lot of development for cross platform including unix, windows, apple, and even arduinos so I'm not coding on a windows OS primarily. I'm on linux right now.
But I really like VS Code. The cpp extension intellisense is still a bit rough around the edges compared to visual studio, but much better than other offerings even at that.
and the extensions.. i can view any kind of file i want. The 31 flavors of makefile, an html file, hell, even a graphviz dot file, complete with graphical preview.
It's fantastic. I don't need 20 editors in my kit anymore. And I think extensions can sync across machines so you might not have to set it up over and over again every time you change machines, although don't quote me on that. I'm still looking into it.
Real programmers use butterflies
|
|
|
|
|
For writing code var is great, for reading code var is not always so great.
I reckon at least 90% of my time is spent reading code.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I agree on the last two points, but I can't say I agree on the first.
var x = retrieveValue();
What type is x ? You could use intellisense in most IDEs to see but that takes time. It also has another subtle but potentially nefarious problem: it shows the actual type but not the type you need. In situations where you require a super/base type but receive a sub/derived type, you may be fooled into thinking that the code expects the sub/derived type if you aren't familiar with the architecture (e.g. maintainers, new contributors). There are a slew of problems that could come from this.
Personally I feel like that last point is largely irrelevant despite being potentially serious since the greater issue is that you've willingly become less expressive purely to save a couple keystrokes. That's just my 2 cents though. I know some projects that liberally use var and have kept the issues under control even if I'd argue the time spent on control outweighs the keystrokes saved.
Also in all fairness my argument blurs the read/write line a bit, but maintenance inevitably requires modifying/writing code.
|
|
|
|
|
But who the hell is naming their function retrieveValue ?
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Someone who's typing up an example?
|
|
|
|
|
Ryan Peden wrote: you can add any number of Deconstruct methods to a class as well
You can also add deconstructors as extension methods:
static class DateExtensions
{
public static void Deconstruct(this DateTime value, out int year, out int month, out int day) => (year, month, day) = (value.Year, value.Month, value.Day);
}
var (year, month, _) = DateTime.Today;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Don't worry, all this will go away as the business model moves to low code / no code solutions.
|
|
|
|
|
Here young programmer: take this rope. Take as much as you need...
cheers
Chris Maunder
|
|
|
|
|
It's all great until you come to debug it, then as a colleague mentioned to me, you find yourself having to refactor the code just so that you can put breakpoints in useful places.
I was taught structured programming back in university in 1988 and while I like a lot of these modern developments they do also need to be used with care bearing in mind that someone is going to have to debug this at some point.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
"
Account Offline!
Your account is currently offline.
This is probably due to a lack of information in your profile. For this reason, some parts of the site may not work for you.
Please update your profile to include all info, especially the last page of your profile.
"
Ummm, yeah... like the ability to update my profile? Sooo... I can't update my profile until I update my profile, OK, gotcha.
|
|
|
|
|
I run into this type of stuff too. It's so frustrating.
Recently signed up for a health care account thing.
They were spamming me.
There was a field that said, "don't send me any email".
I wasn't allowed to choose it unless I gave them my bank account number. I'm serious.
I contacted them via email -- the only option.
I said, turn off that option.
They sent me an email back -- two days later that said please call us at 800.555.1212
What? So stupid.
I emailed back. I'm not going to call you.
Here are the screenshots, uncheck the option.
They finally did it.
They also told me, "you can't set that option because your phone number isn't in the account"
Guess what? The phone number is on the same page in a field right in front of them on the screenshot.
This is how technology makes our lives better.
|
|
|
|
|
raddevus wrote: This is how technology makes our lives better. I don't think that's a problem with technology. I think that's a problem with idiots using the technology.
Not exactly the same.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
No, that’s not a typo.
Objective-J - Wikipedia[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
This was actually pretty neat back in the wild west days of single page web apps.
Standard practice at the time was to assemble 'Web 2.0' apps using a combination of jQuery, duct tape, and hope. So seeing a language + framework combo (Cappuccino and Objective-J) that would let you construct your app's UI using OSX's Interface Builder and then write your application in something other than Ecmascript 3.0 was actually a breath of fresh air, even if it seems a bit crazy now.
And I still wonder if they were onto something here. I still like 280Slides better than Google Slides and PowerPoint Online now, more than a decade later.
FWIW, SproutCore was another framework that aimed to do kind of the same thing but using plain JS. In some ways, it was a progenitor of things like Angular and I still like some aspects of it more than Angular and React.
Heck, I would actually love a modern take on this that lets you build your UI with XCode/Interface builder, then write your code in Swift and compile it all down to WASM. I think there are tools that already let you do something similar using XAML and C# compiled to WASM.
|
|
|
|
|
So I wrote an app using .Net Framework (4.72), and published the article. There are fewer than 6 files to "publish" in the release folder.
Out of curiosity, I re-implemented the code with .Net 5 Core. There are 22 files, six runtime folders, and a refs folder. All told the binary footprint is over 10mb LARGER than with .Net framework.
I don't see the benefit of using .Net Core if it's going to consume that much more disk space.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
isn't the purpose of .net core to be able to run on any OS? I could be mistaken.
If so, a larger footprint is understandable, I guess, as there are more files needed to run on non-Windows Operating systems.
|
|
|
|