Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to re-factor
Message
From
14/02/2013 13:52:50
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01565967
Message ID:
01566052
Views:
59
This message has been marked as a message which has helped to the initial question of the thread.
what is cDetails in the parameter list? This parameter seems misnamed. What is tcDetails? Also misnamed. In .Net, variable, properties should not use Hungarian Notation (this is by convention).

ParseDetails doesn't tell me much about the class. What details? The class name should be more specific about what type of details.

I HIGHLY recommend this book http://search.barnesandnoble.com/Framework-Design-Guidelines/Krzysztof-Cwalina/e/9780321545619
Even if you aren't creating frameworks, it provides good insight on how to build classes in your application.

Also, here the coding guidelines we use. http://csharpguidelines.codeplex.com/

Additionally, learn how FxCop works (or Visual Studio Code Analysis if you're using a VS sku higher than Professional) to check your code. Static code analysis is an important thing to keep your code more maintainable and have fewer bugs.

As for parameter ordering, I don't think it matters. With named parameters, you can specifiy anything in any order anyway when you call it (although named parameters are not recommended).

>
>Here is what I have now:
>
>
>/// <summary>
>        /// Class used to parse tcDetails into common properties (StartTime, EndTime, closeOperator, closeSalesPoint)
>        /// </summary>
>        private class DrawerDetails
>        {
>            public DateTime StartTime { get; private set; }
>            public DateTime EndTime { get; private set; }
>            public String CloseOperator { get; private set; }
>            public String CloseSalespoint { get; private set; }
>
>            public void ParseDetails(String cDetails, String currentOperator, String currentSalespoint)
>            {
>                CloseOperator = cDetails.ParseStringFromSqml("CLOSE_OP");
>                if (String.IsNullOrWhiteSpace(CloseOperator))
>                    CloseOperator = currentOperator;
>                CloseSalespoint = cDetails.ParseStringFromSqml("CLOSE_SP");
>                if (String.IsNullOrWhiteSpace(CloseSalespoint))
>                    CloseSalespoint = currentSalespoint;
>
>                StartTime = cDetails.ParseDateTimeFromSqml("START_TIME");
>                EndTime = cDetails.ParseDateTimeFromSqml("END_TIME");
>            }
>
>        }
>
>and one more question - when I pass this class as a parameter among other parameters - should this class parameter be first? Just want to follow the convention.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform