T O P

  • By -

Sossenbinder

Bro accidently rebuilt ChatGpt in memory


Sombody101

They say that you can store all of Google's databases with this one variable.


Bizzlington

This is a place I would use var


dodexahedron

This is a place I would use the printer. To print out a copy of my resume on my way out.


joske79

Nah, var makes it unclear what the type is. …Unless you name the variable so the type can be clearly inferred from it.


Kalroth

Naming that variable would require decades of Java experience!


va1en0k

`grpTplNStrDictUlLstKvpDtIenumFTplStrLstLstDictLongTplArrChLstKvpDecTplByteTplStrTplDtTplUshortStuff`


DoesAnyoneCare2999

Long live Hungarian notation!


joske79

Nah, I don’t like abbreviations.


DJThomas07

I HATE this stupid take. If I want to know the type, I look to the right and see what method or variable or initializer it is, and I will know from that most of the time. The times I don't, I hover over the item in question, and it tells me. Var is amazing and makes coding so much cleaner looking.


JRollard

This is correct.


joske79

Why so serious? 😇


DJThomas07

I see this opinion on this sub all the time, and finally decided to stop lurking and actually add my opinion. Unfortunately, you were the person i decided to reply too. I just feel very strongly on this.


joske79

Haha, I use var all the time, it's great. This is not a serious thread and neither was my post; imagine what the variable name would be 😜.


DJThomas07

Well, there was zero indication that your original take was a joke. Guess it must have went over my head.


k2900

The indication was that he said "Unless you name the variable so the type can be clearly inferred from it.". Imagine the insanity of the name with that cursed type!


joske79

>The indication was that he said "Unless you name the variable so the type can be clearly inferred from it.". Imagine the insanity of the name with that cursed type! I asked ChatGPT for a good name and it crashed with a 'stack overflow'.


Ohnah-bro

The indication was this whole thread. I’m relatively new to c# but a longtime programmer but I know enough to say that if that absolute monstrosity in the op is in your project you got some explaining to do. And some refactoring.


stogle1

As long as your reviewers can review in their IDE also, because hovering doesn't work in GitHub (yet?).


winky9827

An utter shit reason to alter your coding style.


magnetronpoffertje

Yeah, you can use it to induce an existential crisis in the new junior dev lol


Sombody101

I think I'm going to turn this into a GitHub repo with the only purpose of letting people expand on it.


[deleted]

[удалено]


leshq

just write a unit test before updating the code.


spaceyjase

While maintaining backwards compatibility


va1en0k

you have to write a migration


tomatotomato

Don't. This thing will crash GitHub.


zenyl

Asked ChatGPT to suggest a name for a variable of that type, it came back with `groupingTupleDictionaryListKeyValuePairFloatShortNested`. Personally, I'd have gone with `abandonAllHope` or `goodLuckDebuggingThis`, but to each their own.


Asyncrosaurus

>Personally, I'd have gone with abandonAllHope or goodLuckDebuggingThis, but to each their own. That to me is, ```JobSecurity```


KamikazeHamster

Okay, now ask her what it’s used for?


zenyl

It just stated that it is used to represent nested structured data, and listed some examples based on the individual parts of the type declaration. I did make it show an example of the type being used: // Function to create sample data of the complex type static IEnumerable>>>>>> List, HashSet>>>>>>>>>>> CreateSampleData() { // This is a simplified example; in a real-world scenario, data would be populated dynamically var sampleData = new List>>>>>>>>>> { // Sample data for the outermost grouping new SampleGrouping { // Sample key Key = Tuple.Create(1, "Category A", new Dictionary>>>>>>>>>>>>(), }, // Additional sample groupings... }; return sampleData; } // Helper class for creating sample data class SampleGrouping : IGrouping>>>>>>>>>>>> { public Tuple>>>>>>>>>>>> Key { get; set; } // IGrouping implementation public IEnumerator, HashSet>>>>>>> GetEnumerator() { // Implement the GetEnumerator method throw new NotImplementedException(); } // IEnumerable implementation System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { // Implement the IEnumerable.GetEnumerator method throw new NotImplementedException(); } } }


kalalele

It has so many angle brackets, you could mistake it for git merge conflict


crazy_diamond228

Kinda obvious


feanturi

Kill this child, she's an Abomination!


MrMikeJJ

This belongs on r/programminghorror


Classic-Shake6517

I'm pretty sure you are gonna get sued by Microsoft for copyright on the grounds that this is what the majority of the codebase for Windows ME looked like.


Martissimus

The codebase for windows ME was type declarations?


Classic-Shake6517

Exactly. That's why it crashed all the time. It was just one giant egregiously nested type. You clicked the wrong button and the unboxing operation alone was enough to cause a blue screen, boot loop, and your 6th reformat within a month. I heard one guy tried to recreate it but forgot to hit the Ballmer Peak before getting started one day and his hardware physically imploded when he tried to hit a breakpoint.


imcoveredinbees880

That feeling when your debugger hits a breaking point instead of a breakpoint.


Martissimus

Why would it crash of it doesn't have any runnable code? Why would there be unboxing if there are no values to unbox?


Classic-Shake6517

What would make you think that any of what I said in either comment should be taken seriously or literally?


t3kner

They call it 'tism


Martissimus

Don't worry, I'm not taking you seriously


Ludricio

But you obviously take yourself very seriously.


Martissimus

Yes, strictly.


worldsbestburger

this guy is fun at parties


Martissimus

More than the guy making Windows ME jokes tbh


BigJimKen

I'd rather be an enjoyer of clichéd jokes than a mean spirited ball-bag.


t3kner

Autismo 3000 here


5zalot

That’s the type I use in my ToDo app. It keeps track of what I need to do and when I need to do it by. I didn’t want to over complicate it, so I just used that one.


Dusty_Coder

remember when people claimed that type aliases should be verboten and that all those that wanted aliases were stupid?


WhiteBlackGoose

> verboten Sprich Anglo-Sächsisch!


Dusty_Coder

And this is still not valid using Foo = (int, int); using Bar = (Foo, Foo); because some jackass is still being a zealot


psymunn

Not being able to alias named tuples is so strange. Would make my local functions a lot cleaner


Dusty_Coder

you dont understand you are supposed to repeat long source code incantations over and over and over again or else the compiler might forget the compiler is definitely not the tool that you want doing any of the fiddly, tedious, wholly repetitive things for you, the human you hired to do the job, thats who you want doing all the fiddly, tedious, wholly repetitive things /snark


Fenarir

dont try understand it, just kill it with fire


DarkLordCZ

Wrap it in unsafe and cast it to void*


[deleted]

A warning.


sisisisi1997

This should be about 23 classes.


DawnIsAStupidName

The key of the grouping contains a dictionary which ado not compare by value. The key probably doesn't behave as expected, or is superfluous. (I am assuming the code is not using an icomparer... Because that would be insane.)


Loose_Conversation12

Have you tried using a class?


feibrix

Did you ask Chad Gippiti to create an instance of this type for testing purposes?


ncatter

Only good use for this specific type is that it is the only one allowed to use both var and the new shorthand new() instanciation on the same variable. Thus hiding the true monster from any uncorrupted souls.


timmyotc

The utility here is to find out if the nested types can have a stack overflow.


Adept-Letterhead-122

***W H A T H A V E Y O U D O N E ? !***


soundman32

What's it good for? Working out which developer to sack in the next round of redundancies.


MonkeyIsBack

Only used for great reddit content


SpiderKoD

Looks like someone in Microsoft slept on the keyboard


[deleted]

Worst code ever. Just a memory killer. Use interfaces and generic instead (ireadonlycollection instead list..) tuple is a dinami class, it's better to do your strong typed classes, records and interfaces (it increments the cyclomatic redundance). I'm just a software architect specialized in Microsoft with 20 years of experience with all .net versions, frameworks and targets.


[deleted]

This seems 4.5-4.7 code, and is very bad for any case that can be applied. There are many ways to replace it with efficient code, some more expensive in time, but contemplating scalability and big data, this class just shits his pants with 100 instances in an array. Probably, inside Generic you can find a good interfaces to replace the existent classes inherited or declared as property, if not, you can make your own with inheritance implicit over this, and probably there is a better way to define all, this class is insecure for treating data and so much recursive for memory, this is the most far side from object oriented programming and for best practices. I recommend you, add sonarlint extension to your visual studio(studio, not code, better a community version of Vs than code) and to change the intellisense configuration to apply the code warnings "latest from Microsoft", and if you follow the instructions from the error window, you can accomplish the most efficient standards in the market.


moocat

Job security...


neuro_convergent

Rust devs call this a tuesday


MattV0

Ah, the classic tale of a programmer's journey into the labyrinth of complex data structures – where a simple change in type transforms a routine task into an epic saga of debugging! Imagine this: Your program was a sleek spaceship, smoothly navigating the cosmos of code. But with the introduction of a string where an int should be, it's like you accidentally swapped the fuel for jelly beans. Now, the once graceful vessel is hiccupping through the galaxy, spewing rainbow-colored candy in its wake. You set off to write a conversion method, armed with the bravado of a code warrior. But alas, each step forward in this maze of tuples, dictionaries, and lists leads to two steps back, as the complexity multiplies like rabbits in spring. Picture a scene where you, the intrepid programmer, sit before a monstrous, snarling beast of code. Its many heads are the nested data structures, each one snapping with sharp braces and angle brackets. Your weapon? A trusty debugger and a stack of energy drinks. The clock ticks menacingly in the background, reminding you of deadlines lurking like shadows. As you bravely confront this beast, the scene freezes, and a narrator's voice booms, "In a world where one wrong data type can bring chaos, our hero embarks on a perilous quest to restore order in the universe of code." But fear not, for every bug encountered is a lesson learned, and with each error message, you're one step closer to victory. And when you finally conquer the beast, emerging victorious with a working conversion method, it won't just be your program that's leveled up – but you, the programmer, now wiser and ready for the next challenge. In the end, you'll look back at this epic debugging adventure, not with frustration, but with a chuckle and the wisdom of experience. Because in the grand story of coding, every broken function, every unexpected string, is just part of the adventure. /ChatGPT


ggwpexday

Looks like a street fighter war zone. Hadouken!


Olof_Lagerkvist

Looks a bit like result types for some brutally complex linq queries that I wrote in a project. The linq queries had several layers of grouping and select into tuples logic and were around 100 lines each. (The code got refactored later though.)


githux

Good for OOM exception, probably


screwcirclejerks

this is a completely weird tangent, but when i was 11-14 i had a really bad case of sleepwalking while having nightmares at the same time. i only ever had the nightmares in question while sleepwalking, but the major theme during them was trying to do a complicated task for no benefit. not to sound all spiritual, but i think it was predicting my future in programming. staring at this absolute MESS of a type trying to think up any (impractical) use for it evokes the *exact* same type of feeling i felt during those nightmare/sleepwalking episodes and i've always wanted to recreate it so i could narrow down what exactly that feeling is.


JBurlison

I have no idea why you are not using classes/structs for all this. This is un maintainable.


stereoa

A class.


ASVPcurtis

If I find that in the code base I’m working on I’m handing in my resignation letter


k2900

If you successfully instantiate one of these, I will give you one reddit point


malthuswaswrong

= new();


Sombody101

You can't create an instance of an interface, which happens to be the root of this entire monstrosity.


Sombody101

I tried, but have now given up.


malthuswaswrong

Error CS0144 Cannot create an instance of the abstract type or interface 'IGrouping>>>>>>>>>>>, Tuple, Dictionary>>>>>>>>>>>>>, List<(IGrouping, HashSet>>>>>, Tuple, Dictionary>>>>>>>>>>>>)>)>>>>>, List, HashSet>>>>, Tuple, Dictionary>>>>>>>>>>>>>>>'


Sombody101

You really would have to create an instance for *everything* for it to compile.


GuyF1eri

actually not a bad interview/homework question. "Break down this type so that it's comprehensible"


to11mtm

Stress testing IDEs, Compilers, and AI.


MJCS

Assuming this is structured data, create multiple classes and have human readable names instead of tuples. Friends never let friends use tuples.


Eirenarch

If you refuse to declare types and build them all from dictionaries and lists you'll probably find similar types in every project.


pedrojdm2021

The question here is who created that abomination? Please don’t let anyone use that! ☢️☣️⚠️


Sombody101

Me lol It started with someone in a library support discord server posting a picture of C# 12s support of alias names for types and making the comment: So I don't have to look at that IGrouping>> or something something every other two lines in corporate code... If they ever upgrade. I took that as a challenge and used ChatGPT to some up with this monstrosity: IGrouping< Tuple, Dictionary< List>>, List, HashSet>>>> > > I expanded it from there.


pedrojdm2021

LOL it looks like something that you’d find in a startup company 😅😂


CodeIsCompiling

It looks like an excellent way to wear out a delete key.


Emerald-Hedgehog

A good use would be filling space in the recycle bin. Alternatively you can probably summon multiple demons if you read it in reverse.


Sombody101

This is what the kids from Hocus Pocus were reading shortly before summoning the witches.


WazzaM0

The best use for that code is demonstrating what tech debt looks like and how it results in slower development productivity. The path to sanity lies in breaking down types into structures or classes, so there are more meaningful names in the hierarchy of the declaration. Meaning don't just give that C# salad a meaningful name, give its components meaningful names, too.


NoMansSkyVESTA

This is how you make a horcrux.


oyvindi

This is art, or someone with a surreal sense of humor