Skip to content

Conversation

@cxprofile
Copy link

…request so I forked on my repo

Copy link
Author

@cxprofile cxprofile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be nice to add .editorconfig file to specify custom editor settings for coding style consistency.

Also, the file naming convention of Order.Management project can be confusing when doing this:
Order.Management.Program

As we might mistake "Management" as a file/class name
Project File Name "Order.Management" can be renamed to OrderManagement

public Circle(int red, int blue, int yellow)
{
Name = "Circle";
base.Price = circlePrice;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. call to "base" could be removed as this call is redundant, as constructor of derived class implicitly calls the constructor for the base class - please implement in subsequent cases.

{
Console.WriteLine("\nYour cutting list has been generated: ");
Console.WriteLine(base.ToString());
generateTable();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to exercise standard naming conventions using "PascalCase" for class/functions/method names and "camelCase" for instance variable, arrays, elements and parameter names. Please implement in subsequent cases


<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
Copy link
Author

@cxprofile cxprofile Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to eliminate warning from IDE using .NET version that has deprecated support, we can change to a higher supported version

{
return "\nName: " + CustomerName + " Address: " + Address + " Due Date: " + DueDate + " Order #: " + OrderNumber;
}
public override string ToString() => "\nName: " + CustomerName + " Address: " + Address + " Due Date: " + DueDate + " Order #: " + OrderNumber;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Using lambda expression/one-liners enhance performance and makes the code simpler - may be applied to this method because it does a simple return.

  2. We can also implement additional interface class for Order to Inherit to simplify calls of report functions from the child classes CuttingListReport, InvoiceReport and PaintingReport.

Refer to attached sample implementations:
CuttingListReport.cs.txt
InvoiceReport.cs.txt
IReport.cs.txt
Order.cs.txt
PaintingReport.cs.txt

  1. Please also refer to additional fixes that are not included in this initial commit
    ( referring to above attached Order.cs.txt):
    3.1 additional handling for null exception cases can be added to code
    3.2 Fix on displaying OrderNumber is done - as this displays "0" when run.
    3.3 applied usage of interpolated strings example:
    row += $"{AlignCentre(column, width)}|";

{
class Program
{

Copy link
Author

@cxprofile cxprofile Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for readability purposes, we can add one new line per line of code to separate function/method/instance calls or simply group logical functions.

{

// Main entry
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "<Pending>")]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just adding this part to remove warnings on IDE - to implement "0 warning"

public static Circle OrderCirclesInput()
{
Console.Write("\nPlease input the number of Red Circle: ");
int redCircle = Convert.ToInt32(userInput());
Copy link
Author

@cxprofile cxprofile Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please apply proper naming Convention - change method name from "userInput()" to "UserInput()"

    • please apply to all subsequent calls for this method
  2. Exception Handling - This line would result to exception error when a character input is keyed in - would be good to add another function call that would handle the exception without using try{} catch{} because this is a simple method.

  3. Attached a sample implementation of modified UserInput() for Program.cs for reference:
    Program.cs.txt

abstract class Shape
{
public string Name { get; set; }

Copy link
Author

@cxprofile cxprofile Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard coding practice - add new line for readability of function/method/instance declarations - please apply as needed


public int NumberOfYellowShape { get; set; }

public int TotalQuantityOfShape()
Copy link
Author

@cxprofile cxprofile Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This method call can be converted to Property since method is simple
    Kindly see attached sample implementation of Shapes.cs:

Shape.cs.txt

  1. Also, notice that we can remove unneeded "using" calls - please implement removal of unused "using" statement calls on all affected programs - these are usually greyed out by IDE.


public int TotalAmountOfRedShapes()
{
return base.OrderedBlocks[0].NumberOfRedShape + base.OrderedBlocks[1].NumberOfRedShape +
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per comment regarding calls to "base"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant