Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Inheritence

Inheritence

Scheduled Pinned Locked Moved ASP.NET
salesperformancequestioncode-review
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Learner520
    wrote on last edited by
    #1

    hi guys, I have 13 classes like clsSales, clsOrder, clsInvoice, clsEmail, clsTimesheet, etc..... every class has obviously different fields and properties. But there is one class like Sales which have all fields and properties which other classes have. Now there are 2 options first one I should create all classes seperately like clsSales saleid, orderid, orderdate, invoiceid, invoicedate, emailid, emaildate, timesheetid, timesheetdate. clsOrder orderid, orderdate clsInvoice invoiceid, invoicedate clsEmail emailid, emaildate and the second option is I should inherit all classes from clsSales class. My question is if I Implement 2nd option will this improve or make worse web page performance. thanks kind regards, learner

    N 1 Reply Last reply
    0
    • L Learner520

      hi guys, I have 13 classes like clsSales, clsOrder, clsInvoice, clsEmail, clsTimesheet, etc..... every class has obviously different fields and properties. But there is one class like Sales which have all fields and properties which other classes have. Now there are 2 options first one I should create all classes seperately like clsSales saleid, orderid, orderdate, invoiceid, invoicedate, emailid, emaildate, timesheetid, timesheetdate. clsOrder orderid, orderdate clsInvoice invoiceid, invoicedate clsEmail emailid, emaildate and the second option is I should inherit all classes from clsSales class. My question is if I Implement 2nd option will this improve or make worse web page performance. thanks kind regards, learner

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Learner520 wrote:

      My question is if I Implement 2nd option will this improve or make worse web page performance.

      You won't get any performance problems. Readability, maintainability and choice of design is all matters here. Also inheriting all the classes from sales just to get the common fields is not a good idea. How about a design like,

      Order
      orderid, orderdate

      Invoice
      invoiceid, invoicedate

      Email
      emailid, emaildate

      Sales
      saleid, Order, Invoice, Email, timesheetid, timesheetdate.

      Sales class contains references to related classes. So to get an order id from a sales object, you could write salesObject.Order.orderid. You are not repeating any properties here. BTW, I don't prefix cls to my classes. :)

      Best wishes, Navaneeth

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups