Search Results

Search found 2 results on 1 pages for 'thecapsaicinkid'.

Page 1/1 | 1 

  • Avoiding the Anaemic Domain - How to decide what single responsibility a class has

    - by thecapsaicinkid
    Even after reading a bunch I'm still falling into the same trap. I have a class, usually an enity. I need to implement more than one, similar operations on this type. It feels wrong to (seemingly arbitrarily) choose one of these operations to belong inside the entity and push the others out to a separate class; I end up pushing all operations to service classes and am left with an anaemic domain. As a crude example, imagine the typical Employee class with numeric properties to hold how many paid days the employee is entitled to for both sickness and holiday and a collection of days taken for each. public class Employee { public int PaidHolidayAllowance { get; set; } public int PaidSicknessAllowance { get; set; } public IEnumerable<Holiday> Holidays { get; set; } public IEnumerable<SickDays> SickDays { get; set; } } I want two operations, one to calculate remaining holiday, another for remaining paid sick days. It seems strange to include say, CalculateRemaingHoliday() in the Employee class and bump CalculateRemainingPaidSick() to some PaidSicknessCalculator class. I would end up with a PaidSicknessCalculator and a RemainingHolidayCalculator and the anaemic Employee entity as seen above. The other alternative would be to put both operations in the Employee class and kick Single Responsibility to the curb. That doesn't make for particularly maintainable code. I suppose the Employee class should have some initialisation/validation logic (not accepting negative alowances etc.) So maybe I just stick to basic initialisation and validation in the entities themselves and be happy with my separate calculator classes. Or maybe I should be asking myself if Anaemic Domain is actually causing me some tangible problems with my code.

    Read the article

  • QEMU & libvirt: Dual screen VM?

    - by thecapsaicinkid
    I'm running a Windows 7 guest virtualised under QEMU and using libvirt on a Fedora 17 host, does anyone know if it's possible to create 2 video 'cards' (or a single dual-head) and a spice server for each and connect multiple spice clients to simulate a dual screen VM? Looking through the VMs xml configuration file I can't see a way to associate elements (eg. Spice servers) to elements (in this case, a qxl card). I'm sure qxl doesn't support the dual-head option but are multiple video elements possible?

    Read the article

1