Closed waldo1001 closed 2 years ago
I HATE the 'Good code' version of this. I believe that it lessens readability.
I can see it, IF You have a BEGIN END inside the CASE Statement
case SourceTableNo of
DATABASE::Customer :
Begin
Customer.Get(SourceNo);
Customer.Validate(Name, NewName);
Customer.Modify(TRUE);
End;
DATABASE::Vendor :
Begin
Customer.Get(SourceNo);
Customer.Validate(Name, NewName);
Customer.Modify(TRUE);
End;
Else
Error(TableNotSupportedErr);
End;
I say we bring it up for discussion
Agree, in the case of one liners, the "bad code" example is preferable! Let's spawn a discussion based on this PR.
I like the one-liners too, but discussing it might not solve it. The autoformat feature in AL changes it to multiline code anyway. And what if the case statement is combining one-liners and multi-liners? Anyway, even if everybody agrees that oneliners are more readable, we still have to convince Microsoft to not autoformat the case statement. I think we should publish and have a separate discussion.
I agree with @ajkauffmann - turning this guideline around will take some time. Today, the guideline is as described .. so let's open the discussion when this guideline is published.. ?
Personally, I'm not really thrilled about this guideline. I find the "Bad Code" better readable than the "Good Code".
What do you guys think? And where should we discuss? LIke: