When you find yourself defending an email hard coded into the application, maybe stop digging. Aside from a cobbled together proof of concept, which this is not, there is no excuse.
There are definite times where a simple answer is mocked here when it doesn't need the level of over-engineering that everyone piles on with. This is blatantly not one of those times.
Hard coding is not a bad thing by default. Depends on the context and what you want to do. This code could be in a isAdmin() function, and it would be perfectly fine if it’s a tiny application.
Stop doing more than you need. You are worse for it.
No, it would be not. It’s way easier to change that string than implementing a more complex user access system. Also, the hidden string could be “administrator”, for all we know.
Stop doing more than you need. You are worse for it.
Correct, but woefully misapplied. Also a wonderful strawman you've constructed there.
If this is the hill you want to die on, remind me never to work with you. That you think this is a case where your pithy line applies might not say it all, but definitely says enough.
I don't mind ViewBag for simple things that don't really belong in a business-oriented model, like populating selectlists with options from a database or something.
Same lmao, I use rider and haven’t touched VS in months. I did however change all my fonts, colors, and key maps to VS style. Honestly I think with VS2022 the gap between it and Rider is very slim. VS2019 and previous however is pretty bad in comparison.
Yeah I think a lot of people are sleeping on VS2022 and comparing Rider to 2019/2016. Especially for personal projects where you don't need fancy build/release pipelines, one-click publish to Azure is dope.
72
u/Levyks Aug 12 '22
code I found in production today, username was redacted for confidentiality
7
u/[deleted] Aug 12 '22
Yeah, why would you need roles? Do you know the specifications? Do you need to overengineer everything?
49
u/[deleted] Aug 12 '22
Also, screw types. Let's stick everything in a bag and call them objects so it looks oopy.
Viewbag makes me think of the classic VB Variant type, which could be anything.
70
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Aug 12 '22
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
26
u/BananafestDestiny Aug 12 '22
Wtf is a
ViewBag??10
u/rexspook Aug 13 '22
Using the ViewBag object is a big enough red flag for me lol
5
u/mpak1913 Aug 13 '22
Well in Iran sometimes Clint's are really bitch so I do some hard coded admin to being able to make them angry so they have to pay me my money ....
1
u/Brelee2222 Aug 21 '22
Bouncer: *looks at invitation list*
"Who are you"
Uninvited person: a person
Bouncer: *looks at invitation list*
"ur not invited lol"
*writes that person is not invited*
1
u/catgirlishere Oct 30 '22
Also String.equals() if you’re using Java 😆
-3
u/walmartgoon Aug 12 '22
Asp.Net without visual studio? Blasphemy
0
u/_grey_wall Aug 13 '22
At least md5 the damn thing
0
u/[deleted] Aug 12 '22
[deleted] — view deleted comment