473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

architecture design

I have a software architecture question.
I have developped a dialog based application that reads a contactless card
and display its information(name, 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:CMyDialog()
{
m_csName = "";
m_csCompany = "";
m_csSerial=0;
m_Status = 0;

}

// called every second
void CMyDialog::OnTimer(UINT nIDEvent)
{
ReadContactlessCard()
DisplayInfo()
ArchiveInDB()
}

CMyDialog::ArchiveInDB
{
m_db.Archive(this); // 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 1368
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
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...
25
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...
6
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...
6
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...
4
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...
6
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...
5
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
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...
0
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...
1
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.