In addition to MVVM, as well as MVC templates for the general structure of a WPF application, how exactly do you break down the application model / controller aspect into subcomponents? The reason I ask is because I have no problems with the solution architecture in terms of the patterns mentioned above, but when it comes to writing a backend; I feel like I wash a lot. In the end, I get high-quality applications from the point of view of users, but my design aesthetics does not allow me to accept this.
To clarify; many of my business logic cannot be reorganized into a class (or class hierarchy with all related interfaces) in any simple or meaningful way without changing the entire application. I have been developing professionally for a year and a half, so this may be a problem of inexperience; but I feel that this is not an excuse. Any guidance on this admittedly open-ended question?
Edit: code request (in Silverlight). The following is -snippet- from the mousebuttonup handler in a drag and drop selection application that is part of a larger application
I just donβt like how stupid the logic is, and I hate that all this is completely inactive, because everything is driven into event handlers.
//determine if there is a previously existing allocated sale corresponding to this purchase ID SaleWS allocSaleExisting = colltoaddsale.FirstOrDefault(s => (s.p_TRADEID == allocPurch.TRADEID)); if (allocSaleExisting != null && allocSale.TRADEID == allocSaleExisting.TRADEID) { PurchaseWS allocPurchExisting = colltoadd.First(p => p.TRADEID == allocPurch.TRADEID); //allocPurchExisting.AMOUNT += allocPurch.AMOUNT; allocSaleExisting.AMOUNT += allocSale.AMOUNT; allocPurchExisting.AMOUNT += allocSale.AMOUNT; allocPurch.AMOUNT -= allocSale.AMOUNT; colltoaddsale.Remove(allocSale); //colltoadd.Remove(allocPurch); } else { //Create new "split" item in the data source for the source table PurchaseWS splitAllocPurch = new PurchaseWS { COMMODITY = allocPurch.COMMODITY, CONTRACTNUMBER = allocPurch.CONTRACTNUMBER, AMOUNT = allocPurch.AMOUNT - allocSale.AMOUNT, FORM = allocPurch.FORM, GRADE = allocPurch.GRADE, LOCATION = allocPurch.LOCATION, SHIP_DATE = allocPurch.SHIP_DATE, TRADEID = allocPurch.TRADEID, UNITS = allocPurch.UNITS }; //update the source table selecteditem datacontext with the target allocation id allocPurch.s_TRADEID = allocSale.TRADEID; allocSale.p_TRADEID = allocPurch.TRADEID; allocPurch.AMOUNT = allocSale.AMOUNT; colltoadd.Insert(colltoadd.IndexOf(allocPurch) + 1, splitAllocPurch); } }
design application-design
Jason watts
source share