Thursday, September 26, 2024

Clean Code 𝗖ð—đð—ēð—Ūð—ŧ ð—–ð—žð—ąð—ē 𝗧ð—ķð—―s - ð—Ē𝘃ð—ēð—ŋ𝗰𝗞𝗚ð—ķð—ŧð—ī 𝗕𝗞𝗞ð—đð—ēð—Ūð—ŧ 𝗕ð—đð—ķð—ŧð—ąð—ŧð—ē𝘀𝘀

 public void ProcessOrder(int orderId, bool applyDiscount)

{

    if(applyDiscount)

    {

            //Apply Discount to the order

    }

        // Process the order here

}

ProcessOrder(1000, applyDiscount: true);


Clean Code:

public enum DiscountOption

{

    None,

    ApplyDiscount

}


public void ProcessOrder( int orderId, DiscountOption discountOption)

{

    if(discountOption == DiscountOption.ApplyDiscount)

        {

                // Apply discount to the order

        }

// Process the order

}

ProcessOrder(1000, DiscountOption.ApplyDiscount);

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.