|
|
UML Distilled and Marin Fowler's web site.
--
Cheers,
Gary
http://www.garyshort.org
|
|
|
|
|
Hi,
I was wondering what the formula is to CHECK banaccount numbers in different countries.
I know eg: for Belgium it's AccNrDIV97 = last 2 digits of the Bank accountnumber.
so we can say that 000-0000000-97 is valid for BE to use as bank account number DUMMY !!
I am looking for a DUMMY for Luxemburg (to be used in a mandatory field in a new prg we purchased) can anyone help me find the formula ?
Kind regards,
R.
|
|
|
|
|
Hi,
actually it is MOD97 not DIV97, and I don't know whether -00 or -97 is used when
the 10-digit account number is a multiple of 97.
if you have code that checks LU numbers, just enter some and observe which ones get
accepted/rejected:
assuming the format is ###-#######-##:
try 000-0000000-XX for XX=00 to 99
then 000-0000001-XX for XX=00 to 99
etc obviously skipping the less relevant cases.
Chances are it is very similar to the BE situation.
Alternatively, if you have a (small) collection of valid LU numbers
(as published by LU companies), it should be easy to discover the checkdigit algorithm.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
actually, even if it is the MOD 97 instead DIV 97, the account number 000-0000000-97 is correct, I'm sure about that, it's the dummy for BE that we use !
I can give you a Lux-(lets shorten this word) account number.
I'm curious to let you figure out what the checkdigit algorithm is ! (it's not just 12 char long but 20 char.
LU970030859538550000 or LU950019120377915000
if you need more just let me know (I can't give you any names with those)
have fun !
cya
|
|
|
|
|
Radegonda wrote: if you need more just let me know
I don't need anything; whoever wants to find the check system for LU numbers
will need more than two examples, I would guess some 20 or so.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello,
I'm doing some free-time programming with learning objective (in c#), and one of my "projects" led me to separate data taken from a text file.
Opening and retrieving data is no problem, I just put it into a ListArray<> of string element for now. But when I want to separate the data from that ListArray, the only solution I've come up with is as 'ugly' as this one:
(some code here)
foreach (string str in stream)
{
if (str.contains(some string))
{
do something
}
else
{
if (str.contains(some other string))
{
do other thing
}
else
{
(... even more if's)
}
}
}
I think there should be another way to do this, specially without so much "contains" operations that are time consuming.
Can you give me some directions on how to break such items apart?
I'm thinking this could also be used in other areas like socket communication.
This feels like a very dumb question to me, but if I don't ask, I'll never learn.
Thanks for any help you can give me.
|
|
|
|
|
Have you come up with any good ideas?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hello,
I'm learning and trying to improve my object design skills, so please excuse my ignorance.
I've got a very basic app I'm working on that involves house windows. Each Window is composed of various options (frames, glass, screens etc). Each option has a unit mulitplier used to calculate prices. The window itself has size parameters height & width.
I don't know how to post a diagram, so here is a URL to a diagram of how I would typically design it.
http://www.mxpreview.com/ClassDiagram.pdf[^]
In my example, I would create three classes (window, windows, windowoptions).
The window class represents a single window. The window class has an arraylist propery of windowoption objects. In the window object I have a function that rolls through the windowoptions to calculate the cost of the window. The New() constructor is overloaded to accept an ID, which will load up the individual properties.
The windowoption object represent the various options a window might have. There is really no action done by the windowoption object. It is just used to calculate price.
The windows object is what I'd use to generate the various window objects.
QUESTION:
Am I headed the right direction? Is this a typical way of doing things? Is there any reason to make this more complex?
Any guidance will be greatly appreciated!
Thanks,
Wauna
|
|
|
|
|
The design seems to ok, if i can make 2 suggestions:
1. Have the Window object use a separate object for performing database interaction this could be based on an interface something like IWindowGateway that would have methods to Insert(), Update(), Delete(). A concrete implementation of this could be passed in by constructor or by setting a property (or could be set by using a DI framework). This provides benefits of being able to perform unit tests against Window without DB interaction and also makes a little easier if you need to use another type of storage type.
2. Windows would maybe be better called something like WindowFinder that provides methods that returns lists of Window objects based on Criteria such as FindWindowByQuote(int quoteID) or FindWindowByCost(decimal minCost, decimal maxCost) etc.. as and when needed.
Hope this helps
|
|
|
|
|
Hi stavinski,
Thanks for your input. I think I understood what you suggested. I reworked my class diagram. Here is the link. I'm not 100% certain that I've got the diagram relations correct, but I think I understand what you suggested.
http://www.mxpreview.com/WindowClassDiagram2.jpg[^]
So, to handle db operations I would create a concrete object, and pass it to the constructor as a parameter. Then I could call MyWindowDB.Insert() which would roll through the parameters and perform the update. The advantage to doing this is that a database change would not require me to modify the "Window" class.
Does this seem correct? You mentioned testing, and I think I understood your logic on that. I wouldn't need to modify the database while testing validation and such.
Are there any other reasons to use this type of structure?
The CalculateCost() function would need to be in the interface. How would I keep that logic in one spot? I'm not sure if an interface can contain code like that function. I'm kind of new to this, so I apologize for the ignorance.
|
|
|
|
|
|
Ahhh.. the Gateway is the interface, not the Window. That makes more sense. So SQLServerWindowGateway would contain the Stored Proc calls. An instance of iWindowGateway would reside in the Window object. Then I suppose some parameter would need to be set to determine which Gateway to use (SQL vs Memory). I think I'm seeing the idea....Clever! We will have abstracted the Data reading and writing away from the core objects. The extra layer provides the flexibility to modify the db without interfering with the core objects.
It makes sense.
Thanks Steve!
|
|
|
|
|
You got it!
|
|
|
|
|
also the abstraction allows you to come up with new gateways. let's say you've got the window object on your machine in a SQL DB but you connect your laptop to head office. You can now pass the window SOAPServerWindowGatewayObject and the window is synchronized with Head Office. Equally that could be an IPartListPrintOutGateway etc I'm sure the potential list is almost limitless.
Russ
|
|
|
|
|
My boss told me to design a 3 tire architecture application. I am using C# asp.NET 2005. Since I don't have much idea about the 3 tire architecture, I designed one based on articles found in net. I don't know how much perfect it is. So I like to hear your opinion. I designed it like this.
I created a class library project for data layer named 'DL'. It contains 2 classes. First one is 'DLCommon', which is to declare protected variables of SqlConnection, SqlCommand, SqlDataAdapter est. Its constructor will read and store the connection string in a variable from the config file. The second class is 'DL', which drived the 'DLCommon' class. This class contains the functions to open database, excute sql and stored procedure. Its constructor will open the connection and store in a SqlConnection variable until the object is destroyed.
I created another class library for business layer named 'BL'. This project has several classes. Each class is used to write functions for a particular set of operations. For example I created a class in 'BL' named 'clsUser', which is to write functions for add, edit, and delete the users. These class using a variable of 'DL' class for database operations.
The presentation layer is a web project which using the variables of the classes in the business layer project.
Thomas
|
|
|
|
|
Sounds ok
Normally you have a 3 tire Architecture to isolate things from each other
UI - User Interface
BL - Business lauer where you have all your business logic
DAL - Data access layer where the database acces is in
IO recommend you to also have a look on O/R mappers and specially Castle where you in your BL add some properties to your code and the O/R mapper is taking care of the mapping to the database
Getting started article http://www.castleproject.org/activerecord/gettingstarted/index.html
|
|
|
|
|
Your concept looks OK, but if your are really going to name classes DL and BL you are looking for trouble.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
Hi Everyone,
This is my first post on this board. I've been reading it for over a year now trying to soak up any information I can get.
MY QUESTION:
I need to learn better design skills, but I am a lone coder. Unfortunately, I work by myself so I don't have anyone to bounce ideas off or learn from. How can I take my design skills to the next level? What are your suggestions?
MY BACKGROUND:
Unfortunately, I have been programing for a career for over 10 years. I started with Basic on the Apple when I was a kid. I then began my career with VB, and have since moved onto VB.NET. I became MCSD certified in with Visual Studio 6. I have taken the MS classes on .NET, and have read a few books, but I don't feel like I've got the necessary knowledge to design good systems. I mean, my systems work, but I'm afraid if someone looked at them they'd say, "What the heck were you thinking?!?".
I started to read a book on OO Design, that was based on the Martin Fowler book, but it used Bears, Zoo animals, and flowers as the examples. I didn't find the application of these to be to clear. Most of the time, it doesn't seem like my systems call for complex patterns, but without outside eyes how do I know?
So is the answer reading the right book? Or is it seeking out skilled people to teach me?
Any advice would be greatly appreciated!
Regards,
Wauna
|
|
|
|
|
As you are on your own, I would advise you to pick a reasonably complex problem that has a database, business logic and possibly multiple front-end options. Then, break down your code into the various areas, e.g. data access at the database end. At this point, you should have a reasonable idea about what you expect your system to be composed of, so you could use TDD (Test Driven Development) to take a crack at developing your system.
Normally, I would expect you to do a lot more design up front, but as this is for your benefit only and as a way to experiment with what works for you, you can get to the coding a bit earlier than you would in a real project. Think about what patterns are present in your project, and how you can layer your code for best effect. Then - ask questions here on CP.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
A good start is to read the HeadFirst Design Pattern & Head First Object-Oriented Analysis & Design.Check those out at http://www.headfirstlabs.com/books.php.Contact me any time at stzo_2@msn.com
|
|
|
|
|
These people have a number of resources you will find helpful. To access some of them, you will need to register with them.
http://www.netobjectives.com/[^]
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Another good book about patterns is http://www.oreilly.com/catalog/hfdesignpat/
and also Jimmy Nilsson book where he is beeing like a pair programmer to you
http://weblogs.asp.net/fbouma/archive/2006/06/26/Applying-Domain_2D00_Driven-Design-and-Patterns-by-Jimmy-Nilsson.aspx
|
|
|
|
|
Hi Everyone,
Thank you for all of your responses. It looks like there are lots of books and resources that would be good to review. I'm also going to try posting some of the basics here.
Thanks again!
Wauna
|
|
|
|
|
You want to look at some code of how design patterns etc are applied. MSDN has some really cool sample applications. These applications are full n-tier design and gets stuck right into new concepts like software factories as well as best practices
Try the Microsoft .NET PetShop 4.0
http://msdn2.microsoft.com/en-us/library/Aa479070.aspx
|
|
|
|