|
If you are doing this for learning purposes, then I would say this is not a bad idea. For someone who is learning OO programming, I think it can be useful to sit down and draw out the class structure first because it helps them learn to think in terms of objects and how they interact. Experienced programmers can get away without doing this because they have the experience to know what the rough structure of the classes should be, and they can evolve that as they go. Newbies don't have that depth of knowledge to draw on so they can easily end up with a huge ball of mud that sort of works but isn't maintainable.
I don't think you need to go right down to the level of detailing the function bodies and so on, but sketching out a class diagram will help to get things clear in your mind before you start and make sure that you can see the wood for the trees when you find yourself buried in the coding phase. But don't be afraid to deviate from it when you are coding if you find a better way to do things once you get started. It's a guide to help clarify your thinking, not a rigid plan to be mindlessly obeyed.
It depends on how experienced you are at designing and building this sort of application.
|
|
|
|
|
Hello,
I am having little design problem: I have one factory which will create object of with one type or another type. But my client requirement is to give(feed) the data(via setter methods) from outside world to the concrete class of type-1 not for type-2.
If I place these setter methods in interface, those need to be implemented forcefully both of concrete classes. This is NOT my requirement. I want to feed 1 kind of data for 1st type(some setters) and want to give another kind of data for other type(probably different setters other than which's contained by previous type.)
e.g
class ISubjectExecutor
{
public:
virtual void ISUBJECTEXECUTOR_EXPORTS_API Execute()=0;
};
class COMExecutor: public ISubjectExecutor
{
public:
virtual void Execute()=0;
void setCLSID();
void setGuids();
};
class Win32Executor : public IWin32Executor
{
public:
virtual void Execute();
void setFilePath();
};
Now here I can't use pointer of ISubjectExecutor (*pSubjectExecutor) to call setter methods of Win32Executor or COMExecutor on my choice at any time after reciving pointer(ISubjectExecutor) from factory. Because those all setters never exist inside ISubjectExecutor interface, and you can't access any method which's never contained inside interface and exist in concrete implementation.
How to tackle this design problem to solve.?
Regards
Usman
|
|
|
|
|
struct IParameter
{
int m_ID;
virtual ~IParameter(){}
};
class IParameterSetter
{
public:
virtual ~IParameterSetter(){}
virtual int SetParameter(IParameter *pParam) = 0;
};
class IFactorySpecific
{
public:
virtual void Execute()=0;
};
class ISubjectExecutor : public IFactorySpecific, public IParameterSetter
{
public:
enum PARAMETERID
{
ID_CLSID,
ID_Guids
};
struct CLSID : public IParameter
{
CLSID(){m_ID = ISubjectExecutor::PARAMETERID::ID_CLSID;}
int a;
.....
};
struct Guids : public IParameter
{
Guids(){m_ID = ISubjectExecutor::PARAMETERID::ID_Guids;}
int x;
......
};
};
class IWin32Executor: public IFactorySpecific, public IParameterSetter
{
public:
enum PARAMETERID
{
ID_FilePath,
};
struct FilePath : public IParameter
{
FilePath(){m_ID = IWin32Executor::PARAMETERID::ID_FilePath;}
char cszFilePath[260];
.....
};
};
class COMExecutor: public ISubjectExecutor
{
public:
int SetParameter(IParameter *pParam)
{
switch(pParam->m_ID)
{
case ISubjectExecutor::PARAMETERID::ID_CLSID :
ISubjectExecutor::CLSID *pData = (ISubjectExecutor::CLSID *)pParam;
return ...;
break;
case ISubjectExecutor::PARAMETERID::ID_Guids :
ISubjectExecutor::Guids *pData = (ISubjectExecutor::Guids *)pParam;
return ...;
break;
}
}
virtual void Execute(){.........}
};
class Win32Executor : public IWin32Executor
{
public:
int SetParameter(IParameter *pParam)
{
......
......
}
virtual void Execute(){.........}
};
IFactorySpecific *pExecutor = Factory::GetExecutor("COMExecutor");
ISubjectExecutor::CLSID stParam;
stParam.a = 10;
pExecutor->SetParameter(&stParam);
IFactorySpecific *pExecutor = Factory::GetExecutor("Win32Executor ");
IWin32Executor::FilePath stParam;
strcpy(stParam.cszFilePath, "c:\\abc\\xyz.exe");
pExecutor->SetParameter(&stParam);
Sameer();
|
|
|
|
|
I realized, If I don't serialize the undo queue now it may never find its way into the project (much like undo and redo finding its way into the project).
Are there other things like this that need to go in early or else you're, you know what?
|
|
|
|
|
Deciding if you want your server error (WCF) reported to the client. If you are passing objects/lists they will be strongly typed, if you need to pass back an error object then you are passing vanilla objects.
We decided what breaks on the server stays on the server.
Error trapping in general, you do NOT want to have to touch every method and class after you decide on your strategy.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a requirement that, the text of the controls and other hardcoded values in the application (for eg. exception message such as user friendly message etc.) will be stored and read from database. This requirement is not mandatory,but if present, it will be good.
If provided, the user can go and edit the text whenever he wants.
So I am thinking of what is the best approach of doing this. I can just store it and retrieve from sql query or stored procedures. But, that I think is ugly way of doing it. Is there any other better approach? As I am using ASP.net 3.5 version, I don't want any performance degrade of the pages because of this process.
Could anyone please provide some suggestions or guide me toward some good articles? I searched in google but couldn't find an effective one.
Thanks
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
meeram395 wrote: Could anyone please provide some suggestions or guide me toward some good articles? I searched in google but couldn't find an effective one.
This[^] article on MSDN might help to move all the texts to the database.
You'd still have to provide the user an edit-screen to manipulate the database-texts, and I think that changes wouldn't be visible until you restart the application.
I are Troll
|
|
|
|
|
you can store the value in a SQL Server Database table. Cache the data in application startup using ASP.NET cache engine. Make a SQL Server invalidation cache dependence over the cache, so whenever user changes the value in the table the cache gets invalidated. Repopulate the cache when there is a change in the underlying data table in SQL Server. So you are not pulling the data from SQL Serevr each time and only refresh the data in the cache whenever there is a change in the underlying data...as well as there will be no application restart requirement...a the cached data gets refreshed whenever there is a change in the underlying table....for information on SQL Server invalidation please refer the following link
http://www.wrox.com/WileyCDA/Section/Using-the-ASP-NET-2-0-SQL-Server-Cache-Dependency.id-306459.html[^]
|
|
|
|
|
In visual c++. I want to make a compiler code that search for the $ and then again search for the another $ sign and delete anything between those two $ signs and saves new file called anyname
thx
|
|
|
|
|
interesting
|
|
|
|
|
Yes seems interesting but Need Help getting it done
|
|
|
|
|
mohit`12 wrote: but Need Help getting it done
Since you did not explain where it is that you want to search, i.e. your question is rather vague, it is difficult to offer more than a vague suggestion.
Try this:
Look at each character in turn and when you find a '$' sign make a note of its position. Then continue searching for the next one until you reach the end. If you find a second '$' then remove all the characters between the two positions. Where is the difficulty?
It's time for a new signature.
|
|
|
|
|
Use a regular expression to do this. It's hardly something for this forum though, is it?
|
|
|
|
|
Any1 got suggestion for Best open source UML tool.
thx
|
|
|
|
|
For a free one, you can't go far wrong with StarUML[^].
|
|
|
|
|
|
I managed myself using StarUml and everything worked well so far. seems like that's the only one best open source tool out there in market...
but no doubt on using IBM Rational it's best in all way but it's not free
thx
cheers from canada.
|
|
|
|
|
mohit`12 wrote: no doubt on using IBM Rational it's best in all way
Dear lord no. Enterprise Architect is a much better (and friendlier) solution.
|
|
|
|
|
show computer room design with visual basic
|
|
|
|
|
Are you using this forum as a document repository? Was this the spec you were given, and you decided that you didn't have anywhere else to store it so you just had to post here?
|
|
|
|
|
show some initiative yourself, while others may or may not sleep.
|
|
|
|
|
Go straight ahead and take a left. Go straight. Take a left. Go on for a while, then take a left and go straight until you find instructions written. Follow that.
...byte till it megahertz...
|
|
|
|
|
Hi,
I need to write some C# application that make image analyzing.
I can't decide if the analyzing process (need to be in real time) i will write in C++ ( as com object dll ) or to write it as simple C# class.
someone can help me to decide ?
|
|
|
|
|
Which language do you have most experience of? It's impossible for others to make this decision without knowing your skill level.
It's time for a new signature.
|
|
|
|
|
lets say i need the same effort to do it in c++ and C#.
The question is about the speed of the .net VS speen of the native code.
|
|
|
|