microsoft / alguidelines

Best Practices and Design Patterns for the AL Language
https://alguidelines.dev/
MIT License
129 stars 48 forks source link

Add colors to Bad/Good code headers #158

Closed christianbraeunlich closed 2 years ago

christianbraeunlich commented 2 years ago

How about colorizing the headers "Bad code" in red and "Good code" in green? Example: grafik

TheDoubleH commented 2 years ago

Oh, god no. My eyes are burning. Do not like.

christianbraeunlich commented 2 years ago

Oh, god no. My eyes are burning. Do not like.

The bright colors themselves or in general?

TheDoubleH commented 2 years ago

Oh, god no. My eyes are burning. Do not like.

The bright colors themselves or in general?

Both - I do not like coloring different headline - and if we had to - those colors are sooooper bright

waldo1001 commented 2 years ago

I don't have an opinion. May be if you take a darker green and darker red, it might be better?

PatrickSchiefer commented 2 years ago

Red and Green are not good for color blind people

christianbraeunlich commented 2 years ago

I don't have an opinion. May be if you take a darker green and darker red, it might be better?

grafik

TheDoubleH commented 2 years ago

I Still do not like it -

I understand what You are getting at - But I think if we restructure with example headers?

Example 1

Bad Code

if FindSet() then begin
    repeat
    ...
    until next() = 0
end;

Good Code

if not FindSet then
    exit;

repeat
    ...
until next() = 0

Example 2

Bad Code

if FindSet(FALSE, FALSE) then begin
    repeat
        DELETE();
        Code := 'SAMEASBEFORE';
        INSERT(TRUE);
    until next() = 0
end;

Good Code

if not FindSet then
    exit;

repeat
    ...
until next() = 0

I think we get the same separation that I think You are going for?

StefanMaron commented 2 years ago

I understand what You are getting at - But I think if we restructure with example headers?

Not sure if I have a vote here, but I am with @TheDoubleH I am not a friend of those colors. However, I do agree that a bit more structure would help, and IMO the extra headers do the trick 👍

christianbraeunlich commented 2 years ago

Thanks to all for the awesome feedback! @PatrickSchiefer's comment made very clear to me what I was missing here. Would also be satisfied with the header structures. It's settled then and we can complete one of the remaining tasks from the ongoing discussion https://github.com/microsoft/alguidelines/discussions/161.