|
Help! I'm having trouble reverse engineering the following to OO principles since I'm new to OO.
We are rebuilding an old app which was built without any OO applied back in the day. It has a screen which lets us edit payment conditions. The form has a code, description and 2 more controls: an editbox (holds a number) and a combobox (payment condition). The combobox holds 3 values: "cash", "xx days after delivery", "xx months after develivery". In the editbox I can enter a numeric value between 1 and 99. If I select "cash" in the combobox, the editbox is disabled. if I select "xx days after delivery" the editcontrol hold 1..99 days. If I select "xx months after delivery" the value suddenly means 1..99 months.
How should my objectmodel look in OO? I'm not sure how to implement the edit/combobox-combination of requirements. The combobox is a fixed value, but the edit makes it variable.
Any help is appreciated.
Regards, Ted
- Life would be so much easier if I had the source code!
- If Java had true garbage collection, most applications would delete themselves upon execution
modified on Thursday, May 27, 2010 7:54 AM
|
|
|
|
|
Hi, Ted...
Not sure what is meant by OO in this context. Looks more like a UI design issue. I think I'd ditch the textbox/combobox combination and go with RadioButtons, NumericUpDown and Labels. Wish I could insert an image here, but, it would look like this:
> Three RadioButtons stacked in a column.
> The Text for the top radio button would be "Cash".
> The Text properties for the other two RadioButtons would be blank.
> The second RadioButton would be followed by a NumericUpDown control with a Minimum of 1 and Maximum of 99. To the right of this NumericUpDown control would be a Label that displays "days after delivery".
> The third RadioButton would be followed by another NumericUpDown control with a Minimum of 1 and a Maximum of 12. To the right of this NumericUpDown control would be a label that displays "months after delivery".
The user would select a radio button and, if needed, either enter or select the number of days/months. Based on which radio button is selected, the program will know how to react.
Hope that makes sense. A screen capture would be better. If you want one, I can email it to you.
George
|
|
|
|
|
Hello,
I'm developing n-tier warehouse control system.
I use SQL Server 2008 for database. All data access is done using stored procedures.
The core of the system is windows service, that does all the processing and is "gateway" to database.
There are clients (WinForms & WPF) that connect to this core service via WCF and are basically just GUI (no business logic, only input data validation) clients do not connect to database directly. Number of clients may vary from 1 to few dozen at most. Core service, SQL Server and all clients are on business intranet with fast Ethernet infrastructure (actually physically in the same building).
Now for the "unknown" part: for now I decided to go with typed dataset for business entities and data access with table adapters. Core service and each client has own instance of the dataset. Whenever client modifies data, changes are sent to core service, core service updates database, merges changes to own dataset instance and sends data changes via publish/subscribe WCF service event to all the clients. Clients then merge the changes to own dataset instance. That way I want to ensure that all participating parties (core service and all the clients) have the most current data. Specially one data table holding items that are currently being processed will be changed very often and it is at most important that clients have "real-time" data. This table will have 0 to a few hundred records at most. The largest table (for storage places) will have from a few thousand to a few 10k records.
At least that is the idea ... before I dwell into implementation I want to make sure I'm on the right track. So any tips or critics from users with experience with similar scenarios are highly welcome. My main concern is performance of data refresh on clients side.
If I should provide any more detail that might be of importance, please let me know.
Thanks in advance, Tine
modified 19-Nov-18 21:01pm.
|
|
|
|
|
Your initial design sounds good. It is unusual to use a windows service rather than web service. I assume there is absolutely no possibility of the client being web form based or silverlight.
I question the need for the clients to have the most current data pushed from the server. This is generally a wish from the business that has no real requirement when the cost is factored in.
How do you intend to inform a client that there has been a change?
Is the system a high speed data entry app where concurrency is going to be an issue?
How are you going to manage race conditions across multiple client?
I question the use of typed data sets as the standards are moving to objects, if you use datasets then your client will need to have the that knowledge (I believe it is not possible with SL - no system.data).
I have never used "merged" datasets, I always query back to the database - opinion only.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You are right ... there is no possibility of client being web or silverlight.
I don't understand, what you mean by cost ... you mean cost of time needed for implementation?
As I mentioned there is only one table (0 - few hundred records) that is critical for real-time data. This table holds items being currently processed and changes rather often and must be refreshed as soon the change happens, because operator actions depend on current data.
I intend to inform the clients via dedicated publish/subscribe WCF service. The core service would publish events and clients would subscribe to events. So e.g. when data is changed due to processing, core service would raise an event and event args would hold dataset instance with data changes, the clients would then merge received changes to own dataset instance. Here lies my main concern - is dataset too big data structure to be efficient enough - I'm also considering custom "light-weight" business entities, but it is easier for me to use dataset infrastructure.
I actually didn't give a lot of thought to concurrency - all data tables have time-stamp column and I suppose core service would grant or deny data update based on that value.
I also haven't use dataset merging ... I have done some reading about it and it seems the main problem lies in auto-incremented columns - there is great possibility for duplicate or missing data if used improperly.
Anyway, thanks for your time, it's been helpful, specially for pointing out some issues that I didn't yet think of and might arise.
Tine
modified 19-Nov-18 21:01pm.
|
|
|
|
|
I'm working on a project that stores addresses, and ultimately groups them by Locality/Territories. But along with this there are different stages where an address is first keyed and is "up-for-review". Once approved it would be assigned a Locale/Territory. Along with this a further queue or holding would store Exceptions (addresses that need to marked as "Invalid").
I'm hoping to get some suggestions on how structure the tables.
Currently I have the queue's separated by tables. But as I'm moving along in development this is becoming tedious. For the most part 80-90% of the field names are shared between the different tables (Queues). My thought was to avoid any possible anomalies by separating the queues into different tables.
Questions:
-Would you suggest using one table to store all addresses and a foreign key to determine stage or queue?
-Is this a common way of storing data that is used in Queue processing?
Thanks for your help!!
|
|
|
|
|
I would not duplicate data. And I would avoid the need to move data from one table to another one, so yes I would be inclined to have only one table, and one or more status fields. I also would make sure to have a simple test for "record is valid", best a single "OK" value in a single overall status field, which means the extra status fields only are relevant when the overall isn't "OK". (Of course I prefer numeric statuses!)
FWIW: I avoid multiple tables with the same set of fields; it is only huge amounts of data that would make me come back on this.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Luc, I appreciate your help. Could you clarify though the purpose of your, perhaps boolean field "record valid"? For my specific application an invalid record (perhaps incorrect address) would be moved to a different stageID or queue. Do you also have an additional purpose in mind for this "field value" status field?
Thank You!
|
|
|
|
|
I would have one field that says: this record is completely OK, it can be processed by all reporting or whatever actions your data deserves. So all existing, normal queries only must check one (or one more) field.
All other data is not yet completely OK; it is still in some input stage, and those stages could be identified using one or more fields, as appropriate. Separating the input stage codes from the "all OK" one makes sure your preparation and processing actions are independent of each other.
Just my 2ct.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Ahhh. Thank you for your 2ct's. Its great hearing different ideas as I was thinking about it from a different angle.
|
|
|
|
|
I have seen the projects that have brought run time scripting in to C# and the like. They seem to be very powerful projects, and that is great. For the application I have in mind, I'd like to have a more domain specific, limited scripting support available. Basically restrict the ability to call any method or object that is in the application scope.
I'd like to create a game that has objects with behavior that is "scriptable". The two obvious ways in my head are: A.) Create a graphical interface that allows users to drag and drop elements (if blocks, while blocks, etc.); B.) Allow the user to type in a syntax. (or really both, where A simply creates B)
In order to accomplish B, it seems like I'll need to learn something like ANTLR in order to create a syntax that is completely under control.
I am looking for some thoughts or advice on having an in-game script ability that does not access the entire namespace, while not having to write a syntax parser from scratch if possible.
Jeremy A. Cunningham
Kennebel
|
|
|
|
|
It all depends on the kind of commands/script statements you want to support.
Do you need variables?
do you need different types, like numbers and strings?
do you need program flow, like for loops?
etc.
Depending on the answers, a parser or parser generator might be right; or a simple lexer plus a switch statement might be all that is needed.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thank you for responding.
. Variables, yes
. Types, yes (simple ones like int, float, string)
. Program flow would probably facilitate more advanced behavior
. An OOP option, no (to keep things simple, i don't plan on bringing objects in to the scripting portion of things, method just calls and basic program flow)
So it sounds like i'll need something pseudo-advanced, and will probably have to find, test, and learn a parser generator then.
Now I see why this isn't part of more applications.
|
|
|
|
|
it seems you need a parser; you may write your own, get one some where, or use a parser generator to generate one. The coice is yours, writing one yourself keeps you from studying the features, bugs, and shortcomings of existing ones; and using an existing one, or a generator, may keep you away from the nitty-gritty details involved. As I said, the choice is yours.
FWIW: I create my own parser when I need one.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi !
I've just visited this forum. Happy to get acquainted with you. Thanks.
__________________
Watch Splice Online Free
|
|
|
|
|
I understand what N-Tier is and have made many systems at college using its layered architecture (normally 3 or 4) however I don't know how to apply it in a game!
For example in XNA there is a LoadContent,Update,Draw methods for the game loop but I can only assume that the presentation tier apply s to the "draw" methods, business apply s to "update" and data layer apply s to anything such as loading maps or textures?
Also N-Tier design seems to be slightly counter productive in that its known for reducing performance, which in any game is unacceptable , is N Tier even a good solution for this?
Thanks !
|
|
|
|
|
A DAL could give you an abstraction on all IO, preventing references to the XML-libraries, the StreamWriters and, if applicable to a game, the database.
For all other layers, I'd wonder what value they'd add. See, the presentation-tier will probably be optimized, and you're probably not going to add another UI in ASP.NET.
venomation wrote: business apply s to "update"
That would be assuming that the entire state of the game is persisted (in a database) - I think you might want to optimize this, and only write what's required - and not the lot.
A ComponentLayer might be usefull if you plan on updating the monsters after your first release
I are Troll
|
|
|
|
|
Thanks for that, I done lots of research on N Tiered design but never really considered game development in any of its situations.
|
|
|
|
|
Personally, depending upon the type of game, Multi-tier architecture may not always fit well just due to the potential performance issues, unless you are talking tiers that all reside on the same system, and then it could even induce issues.
Remember, N-Tier is typically used to solve business level solutions where you can perhaps tolerate a bit of lag or delay between layers. In systems where people are going to expect near real-time performance N-Tier may NOT be the way to go.
Now, using for parts of the game like authentication, score keeping, maybe chat areas within the game, sure, but as far as actual game play (again, depending on the actual requirements of the game) N-Tier may not be the best choice.
|
|
|
|
|
Hi,
Has anyone read the book called The Data Model Resource Book by Len Silverston? There is 3 volumes. Is it any good? The data models that he describes, is it still a valid model to use, or is it outdated?
Any other data models that are worth mentioning?
Thanks
Brendan
|
|
|
|
|
Hi,
I'm reading a book on data models, there is a piece of text that reads as follows:
The subtypes within an entity should represent a complete set of classifications (meaning that the sum of the subtypes covers the supertype in its entirety) and at the same time be mutually exclusive of each other. What does this mean? Examples will be much appreciated.
Thanks
Brendan
|
|
|
|
|
Simple minded example.
Suppose an order processing system has a payment method field.
This would be the supertype - every order has to be paid.
Now suppose we break it down by the method used to make the payment.
We could have e.g. cash, cheque, debit card, credit card, money order, etc.
We need to ensure that all the possible methods are covered (i.e. the set is complete). We also need to make sure that a payment can only fall in one method. So, e.g. electronic payment (EFT) would not be allowed because it could be debit or credit card. I.e. debit and credit are mutually exclusive it's either one or the other but it cannot be both.
This assumes the system must distinguish between debit and credit card payments. If it does not need to do so it might be EFT is good enough.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Thank you
|
|
|
|
|
Hi all,
I've recently inherited a couple of projects that I am having a terrible time getting my head around.
As I stare at a method of 600+ lines that is doing all manner of unrelated things, trying to make sense of it I wonder:
Is there a formal name for what I am doing here? Surely this has a name, surely thousands of people have done this sort of thing before, surely there are resources to be had.
Any pointers I could get here? A generic approach maybe? Point me in a direction?
blah,
-Jack
|
|
|
|
|
Is this a .NET project? If it is, you can refactor it - there are tools that help. You could look at Resharper or Refactor!Pro to help you out.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|