9. publicclassSomeClass { ///<summary> /// Returns a boolean to indicate whether a class is /// in read-only mode or not. ///</summary> publicboolReadOnly { get; set; } }
10. ///<summary> /// Helper class to find the shorted path within the graph from one point to /// another. ///</summary> publicclassShortestPath { ///<summary> /// Find the shortest path within the graph from one point to another. /// This method makes used of Dijkstra's algorithm to find the path. ///</summary> ///<param name="point1">GraphNode representing the starting point</param> ///<param name="point2">GraphNode representing the end point</param> ///<returns>The shortest path between two points.</returns> publicStack Calculate(GraphNode point1, GraphNode point2) { // do stuff } }
11. ///<summary> /// Non-recursive implementation of Dijkstra’s shortest path. This class is /// not thread-safe. (Ref: http://en.wikipedia.org/wiki/Dijkstra's_algorithm) ///</summary> publicclassDijsktraShortestPath : IShortestPath { publicStack Find(GraphNodestartNode, GraphNodeendNode) { // do stuff } }
12. publicclassUserManagement { publicvoid Register(UserProfile profile) { // Throw exception if the user exists if (_repository.Load(profile.ClaimIdentifier) != null) { thrownewUserAlreadyExistsException(profile); } _repository.Store(profile); } // other stuff }
19. It looks like you are writing a framework. What do you want to do? Delete all code Looks for something online Find a new job Neal Ford – 10 ways to improve your code
23. Overview “97 Things Every Programmer Should Know”,O'Reilly Media Robert C. Martin, “Clean Code - A Handbook of Agile Software Craftsmanship”, Prentice Hall Martin Fowler, “Refactoring-Improving The Design Of Existing Code”, Addison-Wesley Steve McConnell, “Code Complete - A Practical Handbook Of Software Construction”, Microsoft Press Krzysztof Cwalina, Brad Abrams, “Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries”, Addison-Wesley(http://msdn.microsoft.com/en-us/library/ms229042.aspx)
24. Keep in Touch facebook.com/msdevsa @msdevsa http://blogs.msdn.com/southafrica