|
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.
|
|
|
|
|
Actually, no. You can't run .Net apps with UI's on Linux.
".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
|
|
|
|
|
|
Xamarin isn't desktop Linux.
".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
|
|
|
|
|
Okay. I would not know.
then don't use .net core if it gives you heartburn.
we use it all the time at work and we don't care about the extra files and app size. it's a very trivial thing, really.
|
|
|
|
|
Ya see, I'm old. When I started coding, using as little ram and disk space as possible was a real goal. I still believe that.
I've always had heartburn regarding disk footprint with regards to .Net (and the fact that most of that footprint was hidden in the Win32 folder). With Core, it now needs to be deployed with your app. It's essentially the same as docker containers - you don't have to worry about what version of .net the user has because you're essentially putting the .net dependencies into the container.
I have hundreds of projects on my hard drive. if I compiled them all for .net core, it would consume gigabytes more space than they do right now.
For me, it's not a trivial thing. Really.
".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
|
|
|
|
|
I've been a developer for 30 years and I have exactly the same heartburn. I have to keep telling myself "Disk space is cheap now, memory is cheap now". I have to ignore the little voice telling me, "This machine is MASSIVELY faster than the machine I was working on 30 years ago - why does everything start and run so freaking slow?"
Recursion is for programmers who haven't blown enough stacks yet.
|
|
|
|
|
Yup.... it blows people's minds when I when I tell them one of our flagship products (of the early to mid 90s) had 0.000032GB of "disk space" (EEPROM) and even less RAM. And, by the way, it used a 0.012 GHz processor. And supported five serial ports. (But, of course, had no display, let alone a graphical one, no keyboard, no mouse....)
|
|
|
|
|
|
Bingo! But while cross-platform capability is nice, those of us who only need to target Windows have to take an unfortunate hit. And it only gets worse if you decide to publish as standalone, which balloons a basic "hello world" app to an astonishing 65MiB. Granted, this is not comparable to a .NET Framework build for obvious reasons, but it's still a bit ridiculous. Even a trimmed version is still 25MiB, and this is literally just to print "Hello World!" to the console.
Not really complaining too much though, because I so enjoy using C# and .NET that this is a tradeoff I gladly make
|
|
|
|
|
Yeah, but this is a standalone application that will run (or at least should) in every windows without having .Net Core or .Net Framework installed, because the exe is containing all the needed information to run.
Same 300 KB "hello world" need the 500+ Mb .Net Framework in the background to be executed.
If you are going to have a lot of apps in stand alone... then it is not worthy.
But there are constellations where it might be very usefull and I would not give a crap if the application is 10 times bigger, as long as it runs without having to install anything in the background and even more if it doesn't affect the performance
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.
|
|
|
|
|
.NET Core is alarmingly finicky in how it's built as it defaults to a larger cross-platform "I don't need the .NET Framework" build instead of simply a native one as .NET Framework did.
Try and run
dotnet publish -r win-x64 --self-contained false -o bin/
Then check your bin folder. Should be far smaller with far less files with the limitation that it only runs on Windows.
For a small Linux-only build, you can use
dotnet publish -r linux-x64 --self-contained false -o bin/
Whilst this is smaller, you will now need the .NET 5 Framework (Not to be mistaken with the .NET Framework Framework) installed as you did with regular .NET Framework (One of the reasons your one is so much larger is that it bundles the entirety of the Framework in it as well as it assumes it's not natively installed)
-= Reelix =-
|
|
|
|