473,545 Members | 737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

architecture design

I have a software architecture question.
I have developped a dialog based application that reads a contactless card
and display its information(nam e, company, ...).
So basically I have a CDialog (Windows - MFC) and I would like to save the
information read inside a database (SQLite).

SO I have choosen this architecture :

..cpp
CMyDialog:CMyDi alog()
{
m_csName = "";
m_csCompany = "";
m_csSerial=0;
m_Status = 0;

}

// called every second
void CMyDialog::OnTi mer(UINT nIDEvent)
{
ReadContactless Card()
DisplayInfo()
ArchiveInDB()
}

CMyDialog::Arch iveInDB
{
m_db.Archive(th is); // m_db is an object for a class (CMyDB) used to
handle sqlite database
}

My problem is someone told me that it is not a good design to have a
circular dependency. I mean I declare
a CMyDialog with a CMyDB object and I pass to the CMyDB object a pointer to
the CMyDialog.
How can I do differently?


Jul 22 '05 #1
1 1384
Vince wrote:
My problem is someone told me that it is not a good design to have a
circular dependency. I mean I declare
a CMyDialog with a CMyDB object and I pass to the CMyDB object a pointer to the CMyDialog.
How can I do differently?


Use the technique that /Large Scale C++ Software Design/ calls "escallate
the dependency", and /Agile Software Development: Principles Practices and
Patterns/ calls "Dependency Inversion Principle".

Pass to the CMyDB an abstract base class, containing only those few methods
that the DB layer will use, expressed as pure virtual member functions. Then
CMyDialog inherits this class and implements the methods.

Your friend needs to understand that "isolating changes" is what makes a
design good. Breaking up circular dependencies is a good way to achieve
that, but otherwise if they happen then they happen.

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2593
by: Michael Crawford | last post by:
Hi, Where would one start for this type of application: I want to create an vb.net container application that has the gives the end user the ability to install and uninstall plugins or add-in modules. As the user installs the various components, additional functionality to the application is integrated. How would I structure or...
25
5554
by: David Noble | last post by:
We've been developing a web site using 3-tier architecture for 18 months now. There is a common layer that defines the classes - using XML schemas. The data layer acts as a wrapper to 3 databases - SQL Server, Oracle and AS400. The business layer exposes web services which communicate with the front end, ASP.Net. All 3 tiers are on different...
6
2933
by: Gary James | last post by:
This may not be a direct C# question, but since I'll be using using C# for development, I thought I'd pose the question here. I'll soon be involved in the design of a new software product that will employ a software "Plug-In" architecture. Taking the plug-in route will give us a design that can adapt to, as yet, undefined future...
6
1394
by: V. Jenks | last post by:
I apologize if this is the wrong forum for this, I could not locate one that was exactly appropriate for this topic. Over the last couple of years I've been doing a lot of reading on design patterns and different types of architectures for building high-performance, scalalble n-tier apps. I've used business objects for a while, since...
4
2298
by: Nick Goloborodko | last post by:
Hi, I'm in the process of conceptualizing a new ASP.NET application. I'm a relative newbie in ASP.NET / .NET in general, so any comments will be greatly appreciated. Basically i need to make my application as modular as possible, something along the lines of Mambo (PHP CMS System) Drupal (another PHP CMS) or something similar to these....
6
2157
by: Chad Grooms, MCSD >> [VB.NET,C#,ASP.NET] > [VB.NET | last post by:
Hey all, I have a few questions regarding .NET BLL design. I am a somewhat self-taught developer with limited resources, so I know there are some concepts here and there that I might have missed along the way. To understand my question, it might be best for me to explain my situation...I'll try to keep it short. :) Currently, I...
5
2363
by: Ludwig Wittgenstein | last post by:
Other than the Design Patterns book, which book(s) is/are the best to learn object-oriented software design/architecture from ?
0
1481
by: Joerg Rech | last post by:
Dear software practitioners, consultants, and researchers, we are currently conducting an international survey about architecture and design patterns. Our goal is to discover how familiar people are with these patterns (and anti-patterns) as well as to elicit the information need, the usage behavior, and the experience of software...
0
1593
by: Joerg Rech | last post by:
Dear software practitioners, consultants, and researchers, we are currently conducting an international survey about architecture and design patterns. Our goal is to discover how familiar people are with these patterns (and anti-patterns) as well as to elicit the information need, the usage behavior, and the experience of software...
1
2329
by: abhijitbkulkarni | last post by:
Hello, I am designing a .NET database application that uses 3 tier architecture. Starting initially, this application will be desktop application but I will convert it into a website later but design that I am planning should support both version. Development Environment : VS2008, C# Currently Database supported are MS SQL Server 2005 and...
0
7455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5319
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4940
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3437
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1867
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
692
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.