|
Interesting! I had forgotten some languages don't come with a debugger.
Good one!
|
|
|
|
|
rjmoses wrote: I had forgotten some languages don't come with a debugger.
... and those languages are hopelessly buggered at a result.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
You have to wonder how any of these people manage to do anything useful.
I was sent this this morning: Cyanide & Happiness: Millenials[^] (possibly NSFW, very little of C&A is)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
They don't! If I see one more "I'm ugly. I bet I won't even get one share." on FB, I'm going to unfriend myself.
|
|
|
|
|
You rebel you.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
Depends on what you think is advanced
I use lambdas in C# all the time, but they've been around for over 10 years and now also turn up in other languages like JavaScript and, apparently, C++.
I use named tuples in C#, they were introduced two or three years ago, I think.
I've used pattern matching too.
A comment above this one mentions var and dynamic , I use var quite often and dynamic when I need it.
Basically, if it's in the language, why shouldn't I use it if I have need for it?
Personally, I don't find lambdas difficult to read at all.
In fact, a simple lambda can much better convey what you're doing than a function and be better maintainable.
For example:
myCollection.Where(x => x.IsActive).ToList();
myCollection.Where(IsActive).ToList();
private bool IsActive(Something x)
{
return x.IsActive;
} If the specs change, for example x.IsActive && x.Status == Status.Done , the first is an easy fix, the second would become IsActiveAndStateIsDone or some such, which gets harder to read every time.
In the case when the lambda is an Expression , like with Entity Framework, a function can't even be parsed and you have to use a lambda.
|
|
|
|
|
I'm always fighting reading a lambda. How you would express "x => x.IsActive" in words? Maybe this can help me
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
How would you express a function in words?
I'd say "x => x.IsActive" translates to "element is active".
So in case of a Where you'd get "where element is active" and in case of an OrderBy you'd get "order by element is active".
If you're looking for a more literal reading I'd say "x arrow x dot active", which is a lot easier than describing another function in detail.
I believe they're even called "arrow functions" in JavaScript.
|
|
|
|
|
Thank you for this. I think my confusion comes because I try to read it like mathematical functions e.g. "f: x->x^3"
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Try reading it as a trimmed down function (which now also allow for an arrow instead of curly braces).
myCollection.Where(bool IsActive(MyObject x) { return x.IsActive; });
myCollection.Where(bool IsActive(MyObject x) => return x.IsActive);
myCollection.Where(bool IsActive(MyObject x) => x.IsActive);
myCollection.Where(bool (MyObject x) => x.IsActive);
myCollection.Where((x) => x.IsActive);
myCollection.Where(x => x.IsActive); It is pretty close to the mathematical notation.
Unfortunately, it doesn't always work that well.
myCollection.Where((x, y) => x.IsActive && y > 10);
myCollection.Where((MyObject x, int y) => x.IsActive && y > 10);
myCollection.Where((collectionItem, index) => collectionItem.IsActive && index > 10); Hope this explains it even further.
|
|
|
|
|
Thank you very much, yes this helps I think
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
I am not sure it classifies as advanced but I have used unsafe code with casts and pointer arithmetic in C# a lot and am now switching to Span<t>, ref structs and SIMD instructions
|
|
|
|
|
I like to use 'throw' because a 'goto' that allows you to jump out of your current function to some unknown place is just so cool!
I, for one, like Roman Numerals.
|
|
|
|
|
I use C# var extensively (basically C++ auto) in protest of lack of proper typedef support in C#
Real programmers use butterflies
|
|
|
|
|
While I use lambdas in my C# code, I don't consider them especially 'advanced'. Most of the time I'm actually averse to using such features in any language, because they tend to encourage writing clever code rather than maintainable code. Since I have code in the field older than some of you folks reading this, maintainable wins.
I sporadically read news about new C++ features. None of them inspire me, as they whiff strongly of compiler weenies saying "look what I can do!". They are also overly-reliant on templates, and I find the syntax clumsy and verbose. I consider myself well-skilled in C++, and look for productivity-enhancing changes to the language. They're few and far between.
C# is somewhat a different story. Most of the features I read about seem designed to improve productivity and code quality, even when they are dismissed as 'syntactic sugar'.
Software Zen: delete this;
|
|
|
|
|
Writing clever code instead of maintainable---nahh, nobody ever does that.
My own criteria is that I want to be able to look at a section of code and "grok" it in a few seconds.
|
|
|
|
|
I find it interesting that many seem to think 'var' is such a bad thing. In C++, there's the auto keyword, and there's even the complementary keyword decltype which is particularly useful when you want the result type of an expression, or the return type of a function.
As I understand it, auto fills a similar role as var does in other language(s?), and there's actually a coding guideline promoted by Herb Sutter, no less, to 'aaa', or 'almost always [use] auto'. One of the main reasons is to help enforce type safety, which of course is outstandingly important in C++, probably more than in any other language. Another reason is maintainability: every use of auto probably doesn't need to be changed when you change some type in your code later.
That said, I often deliberately don't use auto, for one (or both) of two reasons: helping with autocompletion (the editor sometimes won't know what member variables and methods to suggest when dereferencing an auto variable), readability (provided the type name is easy enough to read, rather than a nested<type>::with<template_arguments>), and disambiguation (when I want the value to remain unchanged - i. e. const - rather than modifiable). I suspect the former will no longer be a reason when we finally manage to switch to a newer IDE version later this year, that's why I said two reasons
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I agree with Sutter about almost always using auto and will even do this:
const auto& item = ... ;
Another advantage of auto is that there are fewer affected-bys when you rename a type.
Another advantage is that auto reduces the number of line splits, which I like to avoid.
|
|
|
|
|
A slight variation on "that will never happen."
I guess I don't have to explain myself
The customer always does an export at the end of the day, at least according to the customer.
They can't even not do it because their business depends on it.
Needless to say, that's not how they work at all and I just got a month worth of exports all at once
Of course, my code can't handle this because of reasons (mostly because of a ridiculously complicated pre-XML format that I have to use).
The project is over budget and I can't spend any more hours on it.
Sometimes I think I've chosen the wrong profession
|
|
|
|
|
If they told you a daily export was mandatory, and you can prove it is not the case, then maybe you have some leverage because original agreement was broken?
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
We're going to try and make the supplier of the export fix this.
If they export a separate file per date, even when there's x dates, it's fixed too
|
|
|
|
|
My experience: When a customer says "never", it happens about 5% of the time.
|
|
|
|
|
Terry Pratchett said (in Discworld) that when something is a one-in-a-million chance, it occurs nine times out of ten.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
When a customer says "never" I'm about 95% sure it'll happen.
I was pretty sure the "always" part was a bit exaggerated as well
|
|
|
|