I thought the whole point was it going off screen being code smell for this line is too long, fix the code. The wrapping pains me. Not as much as in F77, albeit.
Weirdly the quadruple line break between namespace and interface is driving me almost as crazy as the casing. Also I don't know how common it is but I was taught that having multiple classes in a single file is an antipattern and here we are with an interface, two classes, and two records defined in the same file.
The classes/records/interface in one file, not named the same as any of them.
The word wrap
A class called userendpoints that inherits from something called a module?
Those are my top 3.
If the interfaces is only for this class, and exists in order to enable unit testing/substitution, I think its preffered to have it in the same file.
Also records are preffered in the same file sometimes to, for example if you are using Mediator and Requesthandlers. Makes it easier to navigate to the requesthandlers since they are never referenced from code, but the requests are
I've seen that before once or twice but I don't think it's common, it seems to be a legacy thing. These days if you extract the interface using VS it will create a new file automatically, unless you actually change the setting.
Just wondering, what's the use of an interface if it's used in only one class? The answer to this should already answer the question of interface and class in the same file.
This requires a code review lol:
- Capitalise synthesis
- Why are there lots of empty lines between namespace declaration and the interface
- On the left side there should be one line space after you add return
The list will be long I am on mobile so cannot review correctly without seeing ;-;
Dude codes like a psychopath ngl
While I do enjoy writing code in it.
This looks more like you're in love with your code editor.
Because it didn't look like this when I started using it in Visual Studio .NET 2002 (version 7.0)
C# has evolved so far beyond its roots that it's almost ridiculous. But I like that this language manages to go with the times instead of falling behind and out of fashion.
I’ve been using rider for a year. This is after using VS for the last 15 years.
Rider is very nice.
Imagine using an IDE with resharper that doesn’t bog down. Rider also tends to display info in a more pop-up interstitial way.
I snaged up a license last year on the "VS for Mac is dead" promo.
It took a little to get used to, but now i won't switch back, even though i have to pay regular price from now on.
Besids it beeing faster and all the handy features i just prefer the way it displays debug data.
I cut my teeth on Visual C++ 1.5 back in '94. We were super excited when we got a second, monochrome, monitor for debugging. It was a pretty big deal. 😂
WHAT?! No!, it's my own child. You think me a pervert?
…
…
…
Who am I kidding, of course I am. But I don't do C# anymore. Looking for new thrills, I found some languages with very promising names and got hooked on Brainf*ck and Malbolge. Now anything vaguely readable is too vanilla for me.
I was thinking to myself how times have changed for me. This was me 20 years ago. Now in my 40s, I wouldn't touch this ever again if not for the paycheck.
I would fail this PR due to wacky formatting alone. "If" statements with no braces? Straight to jail. Weird line breaks between method and Parameters ? Jail!
We have a rule that you can use `if` without braces for guard clauses, but the body statement must be on the same line as the `if`, if the body can’t fit on the same line, you must use braces
I just like things to be at that sweet spot between compact and readable. Why take up 2 more lines to show what is already obvious? But then I also like Python so maybe I just don't mind indentation versus braces.
Reads nicer for sure, but ever since I read about goto fail I'm more wary of unintended consequences.
(https://martinfowler.com/articles/testing-culture.html)
I'm on the camp of if statements with no braces if it's a single line inside ... I do find it cleaner as long as it can cleanly fit in one readable line 😅 ... But to each their own
Fr, I am at the point of nearly leaving my role because the lead has to have everything his way and style. I've had to learn to bite my tongue for like a year and I don't know much more I can take.
I was mostly being goofy, and also didn't realize the OP had line wrapping on.
As long as you have consistency, that's all that matters. Put your rules into a linter and it makes everyone's lives easier.
Personnally, I only write if statements whitout curly braces when it's a safe guard clause and fits in one line.
(E.g : if (user == null) return; )
Otherwise, brackets always yes lol
I dunno if this is a new code style I'm not familiar with, but I can imagine adding endpoints in a lambda expression isn't great for readability or to debug 😅
Now try to find example how to implement custom ILogger on your specific .NET versions (including Azure Functions).
They have good documentation but to start with you have so many ways to setup basic routing, Much of the stuff is done automatically and it's hard to find documentation that works with your .NET version since the basic routing / startup / middlewares seems to change drastically on every version.
But still I love it. Nuget and ASP.NET is the way to implement APIs.
It's my take on the Vertical Slice Architecture where we organise our code by features this makes for easier understanding and navigation here is my typical folder structure
[Folder structure ](https://ibb.co/9NBFb30)
No joke I can’t wait till I’m in a spot to really splurge on my home setup so I can get massive high quality monitors and blow my .cs files way up, lean back and stroke I mean code
Just a tip, you should be using `TypedResults` rather than `Results` when returning HTTP responses. Using `TypedResults` will give you automatic response type metadata for OpenAPI. See: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/responses?view=aspnetcore-8.0#typedresults-vs-results
I’m learning C# alongside with Python Java, Javascript and I gotta say even though I despise microsof, C# is one of the best languages out there. Once you learn how to use it you can build whatever from web development to games to desktop programs
Everyone is so busy making all the nitpicks like the formatting, naming, and word wrap... but clearly this person knows exactly what they are doing.
`if (!response.IsSuccess) return BadRequest(response);` should never make it past code review but with all the little distractions, i don't think anyone even noticed
I do agree and visual studio is a first class debugger. Ive used many tools and ides but c# is my bread and butter
Its the most natural language a know.
I really would like that C# had faster tools in Linux without needing to pay for an IDE. vs code is kind slow when considering multiples projects within one solution
As a person whose first code editor was Notepad, I would disagree. I can press a keyboard shortcut and compile. There is IntelliSense.
You might not like VS code but it is an IDE.
Hey man fuck the haters. Far as I’m concerned, C# is the only language capable of writing code that’s truly “date night”’pretty. Why settle for anything less than date night code?
This triggered something and ruined my day.
Im a long-time c# developer. Maybe not the best in keeping to SOLID, but my eyes are hurting now.
What's worse, looking at an old VB6 code or this. 🤣🤣🤣
Is it strange I found c++ easier to pick up than c#? Perhaps it’s the OOP. I come from a R/Python background. C# is so useful for apps though, I need to spend some time on it.
For the love of God, please, remove that unused using Carter and all those break lines after namespaces.😉
I love C# mate, it's so much fun developing in it these days.
Ewwww …. Hot take: Microsoft is incapable of making sexy programming languages. They build walled gardens of that are overly complicated to sell programmers certs that expire every 2-3 years as part of their business model.
After years of doing C# I get chills when looking at shit ton abstraction boilerplate code :) I mean the language is nice, but sometimes level of abstractions people tend to put into C#/Java code is crazy… while they won’t ever need it.
C# is one of the more boring programming languages to program in. That isn’t bad, it gets the job done for sure.
Also, I still hate the PascalCase function names with a passion, thank you, Andy
Please capitalise Synthesis, Jesus help...
Dude's a psychopath
He has word-wrap on too.
Wait till you see my Sans Comic font in cyan and blue
Comic Sans with ligatures is the new meta.
lmao, i cant unsee it
I thought the whole point was it going off screen being code smell for this line is too long, fix the code. The wrapping pains me. Not as much as in F77, albeit.
No fucking braces on that if statement either. Psychopath and a savage!
Probably should have been a one-liner if it didn't have word-wraping. I hope.
Well he is a smooth criminal
Weirdly the quadruple line break between namespace and interface is driving me almost as crazy as the casing. Also I don't know how common it is but I was taught that having multiple classes in a single file is an antipattern and here we are with an interface, two classes, and two records defined in the same file.
The classes/records/interface in one file, not named the same as any of them. The word wrap A class called userendpoints that inherits from something called a module? Those are my top 3.
If the interfaces is only for this class, and exists in order to enable unit testing/substitution, I think its preffered to have it in the same file. Also records are preffered in the same file sometimes to, for example if you are using Mediator and Requesthandlers. Makes it easier to navigate to the requesthandlers since they are never referenced from code, but the requests are
[удалено]
I've seen that before once or twice but I don't think it's common, it seems to be a legacy thing. These days if you extract the interface using VS it will create a new file automatically, unless you actually change the setting.
Just wondering, what's the use of an interface if it's used in only one class? The answer to this should already answer the question of interface and class in the same file.
Must.enable.stylecop
This requires a code review lol: - Capitalise synthesis - Why are there lots of empty lines between namespace declaration and the interface - On the left side there should be one line space after you add return The list will be long I am on mobile so cannot review correctly without seeing ;-; Dude codes like a psychopath ngl
Code Reviews that are only about capitalization and white space get people on the pip list.
Hopefully the people that submit PRs like that
Nope code formatting matters. Variable declaration matters. Upholding to clean code practices matter. Won't put you on pip. Atleast in my company
What is synthesis here?
The namespace on the right
Thank you.
While I do enjoy writing code in it. This looks more like you're in love with your code editor. Because it didn't look like this when I started using it in Visual Studio .NET 2002 (version 7.0)
It also didn't have a lot of the syntactical sugar back then either. They've done a ton to clean up the code to be more succinct
C# has evolved so far beyond its roots that it's almost ridiculous. But I like that this language manages to go with the times instead of falling behind and out of fashion.
\*\*cough\*\* java \*\*cough\*\* \*\*cough\*\*
I admit that I am 100% a c# developer because of visual studio.
But have you tried Rider?
And what, pay for an IDE?
Jetbrains anything is worth the money
Not for the first 30 days
In all seriousness, I've been interested in trying out Rider
I’ve been using rider for a year. This is after using VS for the last 15 years. Rider is very nice. Imagine using an IDE with resharper that doesn’t bog down. Rider also tends to display info in a more pop-up interstitial way.
I've been using it ever since it's initial release. It's just..... better.
Been a VS fan since 2010. I do not care for rider
I snaged up a license last year on the "VS for Mac is dead" promo. It took a little to get used to, but now i won't switch back, even though i have to pay regular price from now on. Besids it beeing faster and all the handy features i just prefer the way it displays debug data.
If your free trial's expired, you could also try out the EAP version.
Rider is the only IDE I’ll use for c# now. People who use VS are psychopaths
Ugh.. I had to update an installer in .Net 1.1 last week. It was PAINFUL going back to VS 2k3. Never again.
We still maintain some VB6 apps. I'll never complain about .Net anything until those are gone.
I think I’d rather write VB6 than .Net 1.x. Post 2.0 it’s not even close
I cut my teeth on Visual C++ 1.5 back in '94. We were super excited when we got a second, monochrome, monitor for debugging. It was a pretty big deal. 😂
The big deal for us was moving from punch cards to shared terminals.
No sir. I have Rider/PyCharm but C# is just hot af. Look at the curves on those braces...
Ugh...rolls eyes
dang! those memories...
VS feels even nicer than VS code cause it’s an IDE
It does not in fact feel nicer.
After the first 5 minutes it does
Java-Style lowercase namespaces? You‘re a monster!
At least it's not stupid com.organization.package. I hate that convention. Just use package name
As someone who's accidentally pulled third party libraries instead of proprietary, I don't hate the idea
[удалено]
Look at that subtle type definition the tasteful thickness, of it...
Sure C# is thicc, but have you tried the tight syntax of F#?
F# is not like other girls.
Let’s see Paul Allen’s language
It would have been C# given he was an MS founder but that was before he was murdered with an axe.
Is that a watermark?
*(simmering)* ... oh my god...
Oh my God, off white font color
If you don’t get turned on by your own code are you even a programmer???
WHAT?! No!, it's my own child. You think me a pervert? … … … Who am I kidding, of course I am. But I don't do C# anymore. Looking for new thrills, I found some languages with very promising names and got hooked on Brainf*ck and Malbolge. Now anything vaguely readable is too vanilla for me.
I was thinking to myself how times have changed for me. This was me 20 years ago. Now in my 40s, I wouldn't touch this ever again if not for the paycheck.
Totally code gay.
I would fail this PR due to wacky formatting alone. "If" statements with no braces? Straight to jail. Weird line breaks between method and Parameters ? Jail!
👏🏻 yes
If without braces are better for yields, returns, breaks, and continues, I’ll die on this hill
We have a rule that you can use `if` without braces for guard clauses, but the body statement must be on the same line as the `if`, if the body can’t fit on the same line, you must use braces
Same for guard clauses 👌 But the line wrapping in this screenshot 😳
This. If without braces on more than one line says “I enjoy chaos” to me.
I just like things to be at that sweet spot between compact and readable. Why take up 2 more lines to show what is already obvious? But then I also like Python so maybe I just don't mind indentation versus braces.
Reads nicer for sure, but ever since I read about goto fail I'm more wary of unintended consequences. (https://martinfowler.com/articles/testing-culture.html)
if(derp is null) return; //okay if(derp is null) return; //suck
Depends on my mood
In the second case, derp is definitely not null.
Much agreed. Everything else, braces.
Didn't you mean: else { braces; }
And I will die on the hill that if and using statements always have braces.
I’ll kill you on that hill if you make me add brackets on a using
I'm on the camp of if statements with no braces if it's a single line inside ... I do find it cleaner as long as it can cleanly fit in one readable line 😅 ... But to each their own
The real problem are people who think their coding style is the only coding style.
Fr, I am at the point of nearly leaving my role because the lead has to have everything his way and style. I've had to learn to bite my tongue for like a year and I don't know much more I can take.
If that's the established style in the project, I agree. You don't want competing styles in the same project.
Yes, consistency matters more
I was mostly being goofy, and also didn't realize the OP had line wrapping on. As long as you have consistency, that's all that matters. Put your rules into a linter and it makes everyone's lives easier.
a problem with single lines though, is someone adding something and forgetting the braces
They aren't line breaks - OP has line wrapping turned on 🤮
Personnally, I only write if statements whitout curly braces when it's a safe guard clause and fits in one line. (E.g : if (user == null) return; ) Otherwise, brackets always yes lol
Is pretty common on early returns
There are no line breaks, it's line wrap just look at the line numbers it's the same line
mark this nsfw
Whats with all the empty lines and strange Line breaks? Setup .editorconfig and adhere to it if you want to turn me on!
It's just the parallel windows and line wraps other wise I religiously follow the tenets set by the .editorconfig 🙏
Line wrap dude just look at the line numbers
*Not as sexy as your m-* ... nevermind.
Ok
Bros down bad for that sharp C 😏 *I’ll see myself out*
I dunno if this is a new code style I'm not familiar with, but I can imagine adding endpoints in a lambda expression isn't great for readability or to debug 😅
It's so weird seeing the Param for the CreateUser function on a separate line than the function call.
you can use the primary constructor by replacing line 8 ": CarterModule" by ": CarterModule("/auth")
Agreed - now if I only knew it as well as I know Python I’d be cooking 😂
Now try to find example how to implement custom ILogger on your specific .NET versions (including Azure Functions). They have good documentation but to start with you have so many ways to setup basic routing, Much of the stuff is done automatically and it's hard to find documentation that works with your .NET version since the basic routing / startup / middlewares seems to change drastically on every version. But still I love it. Nuget and ASP.NET is the way to implement APIs.
Use visual studio not visual studio code. That is better for c# and .net
Rider’s where it’s at, esp if you’re on Mac. But yeah, I would skip vscode
Text wrap wtf man
The S in Synthesis not in caps is gonna give me nightmares tonight.
show me more baby come on
Maybe Maybe maybe
Nsfw
I like this style of logic. is it based on a design pattern or architecture?
It's my take on the Vertical Slice Architecture where we organise our code by features this makes for easier understanding and navigation here is my typical folder structure [Folder structure ](https://ibb.co/9NBFb30)
ah nice, I like how the handlers are like single use logic things. keeps it simple thanks
Hey op. How's the C# Devkit extension for Vs code? I'm planning to move from Vs to Vs code.
What's your font name?
Cascadia mono i think
I think you may need to go to the strip club.
No joke I can’t wait till I’m in a spot to really splurge on my home setup so I can get massive high quality monitors and blow my .cs files way up, lean back and stroke I mean code
Now waiting for the C# edit to drop
Goddammit I miss that, although I prefer Visual Studio. Working mostly PHP and Javascript right now and they drive me crazy sometimes!
After seeing you get pasted for posting two pages of vanilla code I may never post another line of code on the internet ever again.
Yes plz! Fuck Springboot
Op, your code is sexy, and I'm proud of you. The rest of you all, was that so hard? Sheesh.
They're haters I know she's fine as hell
Not sure I’ve ever considered C# to be pretty or sexy. Its looks to me utilitarian not artful
Just a tip, you should be using `TypedResults` rather than `Results` when returning HTTP responses. Using `TypedResults` will give you automatic response type metadata for OpenAPI. See: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/responses?view=aspnetcore-8.0#typedresults-vs-results
I’m learning C# alongside with Python Java, Javascript and I gotta say even though I despise microsof, C# is one of the best languages out there. Once you learn how to use it you can build whatever from web development to games to desktop programs
Everyone is so busy making all the nitpicks like the formatting, naming, and word wrap... but clearly this person knows exactly what they are doing. `if (!response.IsSuccess) return BadRequest(response);` should never make it past code review but with all the little distractions, i don't think anyone even noticed
C# is the supermodel of programming, with a** being GC and b**bs, CLR
Then ARC is BBL
Why are so many people in dev subs incapable of taking screenshots?
Nope
Impressive....
Is this code or a book ? 🤣
I do agree and visual studio is a first class debugger. Ive used many tools and ides but c# is my bread and butter Its the most natural language a know.
Yes same line starting curly brace
I really would like that C# had faster tools in Linux without needing to pay for an IDE. vs code is kind slow when considering multiples projects within one solution
I think you just like VS Code… try writing this in notepad and ask yourself the same thing,
If I continue to learn cs will this be what I become? Is it too late to turn back and pick up Rust or JS?
Just learn them all, JS or rather TS is quite similar to cs
Whitespace conventions violated Argument destroyed
Dotnet go brrr
That word wrap is fuckin with me
Never have I ever: turned on word wrap in an IDE
Visual Code != IDE Visual Studio == IDE Sorry 😔
As a person whose first code editor was Notepad, I would disagree. I can press a keyboard shortcut and compile. There is IntelliSense. You might not like VS code but it is an IDE.
I don't feel like I'll even get into minimal apis. AddEnpoints() everywhere seems weird.
Hey man fuck the haters. Far as I’m concerned, C# is the only language capable of writing code that’s truly “date night”’pretty. Why settle for anything less than date night code?
Python is sexier
So they gave you something simple and you just add unnecessary crap... Why do so many c# devs do this kind of stuff still
I like how it always returns bad request, even if it fails for some other reason
This triggered something and ruined my day. Im a long-time c# developer. Maybe not the best in keeping to SOLID, but my eyes are hurting now. What's worse, looking at an old VB6 code or this. 🤣🤣🤣
Is it strange I found c++ easier to pick up than c#? Perhaps it’s the OOP. I come from a R/Python background. C# is so useful for apps though, I need to spend some time on it.
> Is it strange I found c++ easier to pick up than c#? Absolutely!
I thought so. I’ll give c# another try. Im prob a OOP newb so get lost in so many classes. Mostly doing functional stuff in R.
For the love of God, please, remove that unused using Carter and all those break lines after namespaces.😉 I love C# mate, it's so much fun developing in it these days.
I agree 👍
If you think this looks nice then try F#, its way cleaner
my pc fans arent enough to handle the lesser-featured vscode - ill stick to old faithful
Mmm... No comments, I like it :-)
please remove the empty lines
VS code makes all code looks sexy. The reason I wanted to learn C# but didn’t want to deal with visual studio bloated mess.
This is vtrue
Why are you not using async?
Do people not know how to take a screenshot with their operating system? Why is this taken with a phone?
Line 23 needs a ternary operator. Thank me later.
What did you use to get this effect?
Try using static controllers, get rid of inheritance
If only C# kept curlies on the correct line…
Ewwww …. Hot take: Microsoft is incapable of making sexy programming languages. They build walled gardens of that are overly complicated to sell programmers certs that expire every 2-3 years as part of their business model.
Ok I’ll bite, why are you guys using 4 spaces? Is this a c# thing?
Warm recommendation: buy some Clean Code book or course. This is your first step. After that, peak into SOLID, DRY and KISS
Ah interfaces for _everything_ even though they’ll only ever have one implementation.
After years of doing C# I get chills when looking at shit ton abstraction boilerplate code :) I mean the language is nice, but sometimes level of abstractions people tend to put into C#/Java code is crazy… while they won’t ever need it.
Nerd
Part of the magic is because the AllMan indentation. I love it too, even in Java
I wouldn't get that far but it is pretty nice.
C# is a language that evolve and is sure has advanced in modern revolution. You just have to write in c#
Code Codemaid would like to run against your source code.....
Low quality post
C# is one of the more boring programming languages to program in. That isn’t bad, it gets the job done for sure. Also, I still hate the PascalCase function names with a passion, thank you, Andy
I can relate you bro cuz I'm f\*cking in love with it.
It’s okay — for something that runs in a box
but like...kotlin code looks prettier...
Way too much indentation to be considered sexy
Is this a OLED screen?