|
For a trivial app, you're over-thinking this. Start with some "DFD's" (Data Flow Diagrams).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Basically, I agree with Gerry Schmitz that your question is a case of bringing up a lot of accidental complexity into question.
1. The goal of DDD is to model a complex domain with a lot of business rules. From your specs it doesn't sound like you have a complex business domain. It doesn't sound like you have a domain at all, what you do is just a couple of CRUDs and printing/sending emails.
2. How does something put into the infrastructure layer means that you MUST use a repository pattern? Why do you have to use repository pattern at all? There is a lot of argument that having a repository atop of ORM (if you plan to use one) is a leaky abstraction. Building repository atop of csv, txt generation? Sounds even more questionable.
3. Practicing CQRS means increasing the cost of synchronization between your read and write models? Why is it worth it? To practice DDD, which is the original motivation for CQRS?
4. Basically, you can test it with on a lot of different layers, namely e2e, integration, unit tests.
5. Anticorruption layer means that you have to protect your complex business domain during the integration with legacy service. Do you have a complex business domain worth protecting? I doubt it.
|
|
|
|
|
thx.
the application is a banking app.
it will deal with:account, customers, transactions and other
banking products.
I agree with Gerry Schmitz. I started with DFD and the business logic.
As I said before, I will perform a reading from different
types of data sources(db and file system) this is my app domain.
And for business domain: banking rules, control, security, continuity.
infrastructure:
- repository pattern (EF dbcontext) and uow
- repository for file system (helper parsers )
- repository for Web Services
web services and file system having the same output/input business logic.
DB for saving and checking.
Finally to enssure the continuity we have to process the older (File system) and the newer
data sources (Web service)
|
|
|
|
|
Thanks for clarifying. I believe for modeling some complex business domain like banking system DDD makes sense and what you've provided in your clarification post is a sound approach.
|
|
|
|
|
I'm hoping this is possible in C# as I'm currently starting to learn C#
A black box is a box that you don't know what is inside but you can feed the box data and get a result. The black box has conditions. For example you might have an black box called age where you feed in a persons age and the result is "Under age" is displayed.
I want to have a number of black boxes in a program where once the black box code is written then I can forget about the code in the black box. All I need to do is to feed the black box information and get a result.
I'm thinking that this can be done with the C# class system or maybe there is a better way.
Maybe this setup is possible with an "age" black box and an "account" black box:
age person1 = new age
account person1 = new account
etc
Brian
|
|
|
|
|
Start with a class for each box, and if you want a "true" black box, put those classes in a separate Assembly. That way, you can release the Assembly .DLL file and add a reference to that in your other code with no source code required.
The "black box" code can't be changed without the source, and if you really want to you can use an obfuscator to make the DLL file a lot harder to examine.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks OriginalGriff for your reply.
The purpose of having black boxes was not to protect the code but to make it easier to program and I could use one or more black boxes when writing another program.
I don't know a lot about DLL type fiies but are you saying put the black boxes into a DLL and have the program refer to the DLL file...or maybe have a DLL for each black box?
Brian
|
|
|
|
|
Either way. If they are related function, then the same assembly makes sense. If not, then separate them by functional groups.
A DLL file (a class library in Visual Studio) is a .NET file which is compiled and is identical to an EXE file, except it lacks an entry point (the "Main" function).
By putting black box code in a separate assembly, you release the compiled file and the inner workings can't be seen or changed by the users. Much the same as you don't normally look at or try to modify the mechanics of the string.Substring method in your code (though you can access the Reference Sources if you want a look at how .NET does it).
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the info OriginalGriff.
I might have a closer look at how dll files are created in C#.
Brian
|
|
|
|
|
A "black box" is a "component" (class) with a "clean" explicit interface.
There are specific "properties and methods" (class members) that are explicitly made public for the sole purpose of interfacing with the component.
Contrast this with a component where EVERY member is simply defaulted to public so that there is no control over how the "internals" of the component are accessed.
It's a design strategy.
"Black Boxes" can be / have static members, much like the "Math" class.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi Gerry.
One of the reasons to have black boxes is to keep the code cleaner rather than have pages of code I can refer to the black boxes in my code which reduces the amount of code written.
It's a bit like not having to write a lot of code when you want text printed to the screen in C# you just need to type Console.WriteLine ("").
If I was to write a text adventure program in c# then one of the black boxes would handle the players inventory.
As I'm new to C# what type of things should I be looking for that point me in the wright direction and would help me create black boxes.I have books on C# and some reference on the internet.
Brian
|
|
|
|
|
You're talking about "modules" in general and confusing it with the "black box" (concept) which has to do with "interfacing" and "hiding" module "internals".
On the surface they all look the same; it's the design (or lack thereof) of the interface that differentiates them.
Contrast this with a "white room" where designers come up with new products, (supposedly) "isolated" from the risk of "stealing" from other people's products.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I call them black boxes as that's the best way to describe them.
To me a black bode is some code that's not in the main program but can be called then needed.
Having black boxes reduces the amount of code that is written as the rest of the code is in black boxes.
I cam across a example program recently where the main program calls another program to do a check and display the status. The program it called to me would be a black box as the code for the called program does not appear in the main program.
example:
//Main Program
dante.checkTemperature
dante.showAttributes
I'm wondering if there is a limit to the number of black boxes I can have in a program and how I would refer to a certain black box as the code above is for one black box.
Brian
|
|
|
|
|
So I've been working with making my windows form app work on multiple monitors such as centering my progress dialog on the screen that the app is running on using the Screen Device Name, running some math and setting the parameters to center the dialog window. So this works fine when the app starts on the monitor, but when I move the app to another monitor, the Screen device name remains the same.
I'm trying to figure how to update the Screen device name when you move the app to another monitor.
Searching the web so far has produced nothing because I don't even know what to call this.
But I will start with the Screen class after this and see what I can dig up.
So far I've been able to save the App's window parameters so that it opens again on the right monitor, if the app is closed in a minimum state I can make it normal and open on the correct monitor.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Maybe my issue is a flawed thought in how I calculate this. I used the device name because I wasn't able to do the math on the primary monitor.
public ProgressDialog()
{
InitializeComponent();
this.AutoScaleMode = AutoScaleMode.Dpi;
this.AutoSize = true;
Screen myMonitor = Screen.FromControl(MainForm);
this.StartPosition = FormStartPosition.Manual;
this.Top = (myMonitor.WorkingArea.Height / (double)2) - (this.Height / (double)2);
if ((myMonitor.DeviceName.Contains("DISPLAY1")))
this.Left = myMonitor.WorkingArea.Width / (double)2 - (this.Width / (double)2);
else
this.Left = myMonitor.WorkingArea.Right - (myMonitor.WorkingArea.Width / (double)2) - (this.Width / (double)2);
Console.Write("Stop");
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I just writing this in case I need to go back and figure it out again. So far it works pretty good but I'm sure there's a better way of doing this. Well the idea is that if you have multiple displays, 2 or 3 running horizontal, and you keep moving the app around to a different monitor, or overlapping 2 monitors, and you want to get your progress dialog centered in the application. I tried a whole of ways of doing this, but the parameters I saved on the main form when changed, would not update when accessing it from the progress dialog.
So I took my global class and added a Rectangle to it. I wrote this in VB but used this forum to ask the question.
Friend Module Global360
Public Property GOnline As Boolean
Public Property MfRectangle As Rectangle
End Module
Then on the MainForm in the Event Location Changed, I added this
If mainForm.WindowState = FormWindowState.Minimized
Global360.MfRectangle = Rectangle.Empty
Else
Global360.MfRectangle = Nothing
Global360.MfRectangle = new Rectangle(mainForm.Left, mainForm.Top, Me.Width, Me.Height)
Application.DoEvents()
End If
And in the Progress Dialog, I wrote this in Form New
If (Global360.MfRectangle <> Rectangle.Empty) Then
Me.StartPosition = FormStartPosition.Manual
Me.Top = ((Global360.MfRectangle.Height - Me.Height) / 2) + Global360.MfRectangle.Y
Me.Left = ((Global360.MfRectangle.Width - Me.Width) / 2) + Global360.MfRectangle.X
Else
Me.StartPosition = FormStartPosition.CenterScreen
End If
I'll change the code as soon as I get it working in C#
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
If you get this working "too well", you'll find that if you don't keep ALL your monitors on, the app will wind up "displaying" on a monitor that you don't have access to (if that's where it last displayed).
It shows in the Task Bar but that doesn't help in moving it (again).
(Same thing happens with UWP because it does all the "location saving and restoring" for you).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I didn't think of that!
So far so good, works great across 3 monitors horizontal.
And works on my notebook with one monitor.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I'm new to programming in C#.
Could someone tell me what is wrong with this code please.
Every time the user clicks the button a count of user clicks is shown in a text bo.
namespace Click_Counter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
int Clicker=0;
}
public void button1_Click(object sender, EventArgs e)
{
Click_Counter();
}
}
public Click_Counter()
{
Clicker++;
ClickCounterBox.Text = "You clicked the button " + Checker.ToString();
}
}
|
|
|
|
|
Clicker is declared inside the Form constructor:
public Form1()
{
InitializeComponent();
int Clicker=0;
} Which means it is a local variable - it's scope is restricted to the set of curly brackets in which it is declared. When it goes out of scope (i.e. outside those curly brackets) it no longer exists, and the variable is destroyed (but not it's content - you'll find out about the difference later).
So you can't use it in your Click_Counter method even if it was in the same class - which it isn't - or would compile, which it wouldn't as it doesn't specify a return type. Only Constructors can be defined without a return type! And "Clicker" is not the same as "Checker"!
Move the Clicker definition to class level, so it's not inside any method, move the Click_Counter method inside the Form1 class, give it a return type, and get the names right:
namespace Click_Counter
{
public partial class Form1 : Form
{
private int Clicker=0;
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
ClickCounter();
}
public void ClickCounter()
{
Clicker++;
ClickCounterBox.Text = "You clicked the button " + Clicker.ToString();
}
}
} I declared Clicker as private so it's only available inside the class - you only expose what you need to to the outside world!
I've also changed the name from Click_Counter to ClickCounter, as that's the standard naming convention: you don't use underscore in names except in special cases in C#
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks OriginalGriff for the information.
I altered my C# code to make the corrections you made but it's C# is indicating errors in ClickCounter() next to the word public [method must have a return type] and also an error in ClickCounterBox [The name ClickCounterBox does not exist in the current ccontext].
What must I do to correct this?
Brian
|
|
|
|
|
1) Read my code again, and compare it to yours!
2) Check your Design view and see what you named the textbox you are trying to display in.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi OrginalGriff.
I'm still getting an error on the "ClickCounter()" code [next to the word public]
I've made the changes and this is my updated code.
namespace Click_Counter
{
public partial class Form1 : Form
{
private int Clicker = 0;
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
ClickCounter();
}
public ClickCounter()
{
Clicker++;
ClickCountBox.Text = "You clicked the button " + Clicker.ToString();
}
}
}
Brian
|
|
|
|
|
Member 14154627 wrote: public ClickCounter() You must declare a return type in all methods other than constructors and destructors as OriginalGriff already showed you. It should be:
public void ClickCounter()
|
|
|
|
|