Click here to Skip to main content
14,335,363 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: CCC is getting earlier and earlier Pin
super23-May-19 22:04
professionalsuper23-May-19 22:04 
GeneralRe: CCC is getting earlier and earlier Pin
OriginalGriff23-May-19 22:56
protectorOriginalGriff23-May-19 22:56 
GeneralRe: CCC is getting earlier and earlier Pin
OriginalGriff23-May-19 23:04
protectorOriginalGriff23-May-19 23:04 
GeneralRe: CCC is getting earlier and earlier Pin
pkfox24-May-19 3:54
professionalpkfox24-May-19 3:54 
GeneralWSO CCC 2019 05 24 Pin
Tim Deveaux23-May-19 18:27
memberTim Deveaux23-May-19 18:27 
GeneralRe: WSO CCC 2019 05 24 Pin
OriginalGriff23-May-19 19:51
protectorOriginalGriff23-May-19 19:51 
GeneralRe: WSO CCC 2019 05 24 - Winner! Pin
Tim Deveaux23-May-19 19:52
memberTim Deveaux23-May-19 19:52 
GeneralHow to make simple code complicated Pin
Super Lloyd23-May-19 15:11
memberSuper Lloyd23-May-19 15:11 
At first glance real application (new) code from someone else always looks complicated, and one has to work with it for a while to find it, eventually, simpler. And sometimes I wonder if with old age and worst memory I suffer from that more.

Yesterday I mentioned some code looks excessively complicated for no reason, i.e. it does very simple task, and I got an incredulous look from a fellow developer... Maybe I was wrong?

First I am always confused by the double layer of obfuscation where getting something from the db goes through 2 pass-through layers, each hidden behind their own interface, that return "data model". Thanks god for Go To implementation and also sometimes some property are not named like the columns, or swapped around, tricky...
I guess I am getting old here..

But then I stumbled on that (code simplified for sake of "clarity")!
And I knew I was right, it's not just me, code was complicated!
void DoSomething()
{
   foreach (var d in Data)
   {
      if (MustDo(d.Code))
      {
         // do it!
      }
   }
}
bool MustDo(string code)
{
   if (BigCondition)
   {
     return GetData(code)?.Should ?? false;
   }
   return false;
}
AData GetData(string code) => Data.FirstOrDefault(x => x.Code == code);

clearly this is over complicated and can be rewritten
void DoSomething()
{
   foreach (var d in Data)
   {
      if (BigCondition && d.Should)
      {
         // do it!
      }
   }
}

And there is much much more of it... Cry | :((
Well I guess that's why they pay me! Laugh | :laugh: Sniff | :^)
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 23-May-19 21:41pm.

GeneralRe: How to make simple code complicated Pin
BillWoodruff23-May-19 18:51
mveBillWoodruff23-May-19 18:51 
GeneralRe: How to make simple code complicated Pin
Super Lloyd23-May-19 19:42
memberSuper Lloyd23-May-19 19:42 
GeneralRe: How to make simple code complicated PinPopular
Jörgen Andersson23-May-19 19:57
protectorJörgen Andersson23-May-19 19:57 
GeneralRe: How to make simple code complicated Pin
lmoelleb23-May-19 20:03
memberlmoelleb23-May-19 20:03 
GeneralRe: How to make simple code complicated Pin
Super Lloyd23-May-19 20:34
memberSuper Lloyd23-May-19 20:34 
GeneralRe: How to make simple code complicated Pin
GenJerDan23-May-19 19:53
memberGenJerDan23-May-19 19:53 
GeneralRe: How to make simple code complicated Pin
Jacquers23-May-19 19:54
memberJacquers23-May-19 19:54 
GeneralRe: How to make simple code complicated Pin
Super Lloyd23-May-19 20:33
memberSuper Lloyd23-May-19 20:33 
GeneralRe: How to make simple code complicated Pin
Richard Deeming24-May-19 1:00
mveRichard Deeming24-May-19 1:00 
GeneralRe: How to make simple code complicated Pin
lopatir23-May-19 20:54
memberlopatir23-May-19 20:54 
GeneralRe: How to make simple code complicated Pin
kmoorevs24-May-19 3:59
memberkmoorevs24-May-19 3:59 
GeneralRe: How to make simple code complicated Pin
Rick York24-May-19 4:58
mveRick York24-May-19 4:58 
GeneralRe: How to make simple code complicated Pin
Dean Roddey24-May-19 6:36
memberDean Roddey24-May-19 6:36 
GeneralRe: How to make simple code complicated Pin
Fueled By Caffeine23-May-19 21:44
memberFueled By Caffeine23-May-19 21:44 
GeneralRe: How to make simple code complicated Pin
wout de zeeuw24-May-19 1:06
memberwout de zeeuw24-May-19 1:06 
GeneralRe: How to make simple code complicated Pin
#realJSOP24-May-19 2:56
mve#realJSOP24-May-19 2:56 
GeneralRe: How to make simple code complicated Pin
Gary R. Wheeler24-May-19 3:49
memberGary R. Wheeler24-May-19 3:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.