It's Design

Posted by: K. Scott Allen, on 26 Jan 2011 | View original | Bookmarked: 0 time(s)

If I come across this code: if (widget.Price < 10.0m && widget.UnitsInStock > 100) { // ... } Then the first thing I'll suggest is refactoring to: if (widget.IsEligibleForDiscount) { // ... } But It's Not Reusable! "IsEligibleForDiscount will never be reused!", someone will shout. "Why do we go to the trouble if the logic is never reused?". Ah, yes - but if we only use encapsulation as a means to generalize and achieve reuse, then we're not taking advantage...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Refactor | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 676 | Hits: 57

Similar Posts

  • SQL SERVER Technical Reference Guides for Designing Mission-Critical Solutions A Must Read more
  • Designing a Windows 8 Metro style app starting from an existing Windows Phone app Design Case Study Part 1 more
  • My Top 5 Visual Studio 11 Designer Improvements for ASP.NET 4.5 Development more
  • Gliding into a .Net Micro Framework UI design with GLIDE more
  • A financial dashboard designer based on RadDiagram more
  • Odd MVC 4 Beta Razor Designer Issue more
  • Mobile Design Pattern Gallery: UI Patterns for Mobile Applications more
  • Common Design Patterns Presentations more
  • By Design? BindingFailure - An assembly failed to load while using XMLSerialization more
  • How to design a Windows 8 Metro style app starting from an existing Windows Phone app Part 2 more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD