decoupling

Best place to start decoupling objects

This is a C# question, but really could be language-agnostic I have inherited a large object model (100+ types), with a hierarchy of objects that 'own' 0..n of other typed objects that all share a base (where there is a 'relatively' strict type hierarachy). I want to start decoupling these objects though inheritance to put together an ...

When would you ever use In-Proc WCF Components?

I'm studying Juval Lowy's excellent Programming WCF Services and I've just created a really simple in-proc component using his InProcFactory class that comes along with his ServiceModelEx library. Why would you do this instead of using just regular classes in your project? Using his method requires referencing his library and creating ...

How to resolve specific circular dependency: DAL & Logging

Some "high risk" data operations need to be logged. In this case, the "high risk" operations are defined as writes to our ERP system. It happens that we are logging those events to our SQL Server database. Pseudo-code: Public Class MyCompany.DAL.ERP { Public void WriteToERP(string msg) { // ... do the write MyCompany.Loggin...

SubSonic data layer that returns POCOs instead of SubSonic's ActiveRecord objects

I want to use SubSonic (2.2) in an application I'm building because I like its simplicity and it handles any type of query I can foresee needing. At the same time, I want to keep the upper layers of my application de-coupled from the Subsonic Types. I want to return just Plain Old C# Objects and also pass in POCOs to be saved. But here'...

Progress bar and multiple threads, decoupling GUI and logic - which design pattern would be the best?

Hello, I'm looking for a design pattern that would fit my application design. My application processes large amounts of data and produces some graphs. Data processing (fetching from files, CPU intensive calculations) and graph operations (drawing, updating) are done in seperate threads. Graph can be scrolled - in this case new data...

Decoupling vs YAGNI

Do they contradict? Decoupling is something great and quite hard to achieve. However in most of the applications we don't really need it, so I can design highly coupled applications and it almost will not change anything other than obvious side effects such as "you can not separate components", "unit testing is pain in the arse" etc. W...

How to further decouple this WPF example toward MVC, MVP, or MVVM?

I've decoupled events in this WPF application in the following way. What is the best way to continue decoupling? Shell.xaml: <Button x:Name="btnProcess" Content="Process" Margin="10"/> Bootstrapper.cs: public void Run() { Shell shell = new Shell(new Customer()); shell.Show(); } Shell.xaml.cs: public Shell...

DataTable Wrapper or How to decouple UI from Business logic

I am using web forms, C#, Asp.net. As we all know, in this model UI and business logic are often mixed in. How do I separate these effectively? The example I would like to use is: I have a GridView and a DataTable (GridView binds to the DataTable and DataTable is fed from the stored procedure). I would like the GridView (UI) and DataT...

Entity Framework and coupling

Hi, I had a little discussion with a friend of mine about the use of Entity framework. I had a project where I made a 3 tier solution with the entity framework as my datalayer, and used Data Transfer Objects to move from the business tier to user interface. I really liked the loose coupling it gives, since I can change the entity framew...

Should Business Logic objects have knowledge of their LINQ-to-SQL data objects?

I've looked at several similar questions but I didn't see any that directly applied to me, so forgive me if this is a duplicate. For separation of concerns I'm trying to somehow map my business objects with logic to the LINQ to SQL data objects in the .dbml file (fairly new to this btw). What its looking like though is that my business...

Using delegates instead of interfaces for decoupling. Good idea?

When writing GUI apps I use a top level class that "controls" or "coordinates" the application. The top level class would be responsible for coordinating things like initialising network connections, handling application wide UI actions, loading configuration files etc. At certain stages in the GUI app control is handed off to a differe...

How to decouple an app's agile development from a database using BDUF?

G'day, I was reading the article "Database as a Fortress" by Dan Chak from the excellent book "97 Things Every Software Architect Should Know" (sanitised Amazon link) which suggests that databases should not be designed using an agile approach. There's an SO question on agile approaches and databases "Agile development and database cha...

.net mvc single admin section multiple sites

Hi, Desired outcome: 4 customer facing sites as separated projects 1 set of admin code used by all four sites My current setup is 4 Projects: Core for models/entities Data for repositories Controllers for, well, controllers Web for views Now, the Web project contains views for admin and customer facing sides. I'm wanting to split ...

Using interfaces with Linq-to-Sql for decoupling

I am re-factoring a model class into an interface. The model class is auto-generated with Linq-to-Sql. class FooRepository { // ... public void Add(IFoo foo) { db.Foos.InsertOnSubmit(foo); } } The InsertOnSubmit method takes an instance of Foo, not an IFoo. I can cast the instance inline to (Foo) and th...

Managing resources in a Python project

I have a Python project in which I am using many non-code files. Currently these are all images, but I might use other kinds of files in the future. What would be a good scheme for storing and referencing these files? I considered just making a folder "resources" in the main directory, but there is a problem; Some images are used from w...

Alternatives to "using" keyword in C#?

I just finished watching an episode of Bob Martin at NDC where he said "using" directives in C# at the top of a page are bad because of the tight coupling they create/imply between components. What way are there to use external .dlls without adding a project reference and a using statement? I remember V6 used to let you create an obj...

Handling security and be decoupled

I am trying to design an application in 3 layers : 1) Data access layer 2) business layer 3) UI I try to keep classes decoupled so on the business layer I have created interfaces for the Data access classes like this : public interface ICountryRepository:IRepository { Country GetCountry(int ID); int CreateCountry(Country ob...

Register User Interface Elements in Engine / Controller

Hello everybody! I am currently writing a little game with standard UI controls. It is working great so far but what I don't like is that I am managing the controls in the codebehind file. (C#) As I am trying to decouple all elements, I would like to have a separate engine / controller which handles all the data management and the log...

Menu service in Prism application CAL

Hello all, I am trying to create a Prism (CAL) framework (this is my first forray into CAL) and am having difficulty devising a service for registering menu items for a region). Here is what I have come up with so far... /// <summary> /// Menu item service - allows any module to register menu items with any region /// </summary> public...

Database good system decoupling point?

We have two systems where system A sends data to system B. It is a requirement that each system can run independently of the other and neither will blow up if the other is down. The question is what is the best way for system A to communicate with system B while meeting the decoupling requirement. System B currently has a process tha...