I'm looking for any guidelines along the lines of XSD Best practices
for the following issues.
If you are modelling something like interest rates, there is a choice
of how you represent that interest rate. For example you could
represent an interest rate of 5.125% as "5.125", or you could represent
the rate as "0.05125".
Somewhere you need to have some information about what 'style' is being
used
One option is an attribute
<InterestRate representation= "percentage">5. 125</InterestRate>
or
<InterestRate representation= "decimal">0.051 25</InterestRate>
However this does give flexibility, but it does mean you have to
represent the style every time it is used.
I see that the alternative is to restrict to one choice, and move that
the schema as a comment.
Another option is to put out both choices all the time. Perhaps as
attributes.
<InterestRate decimal="0.0512 5" percentage="5.1 25"/>
Then there are the question of what I call domain values. For example,
there is an ISO standard for currencies. It is a three letter code. USD
for US dollars. GBP for pounds sterling,...
Here, you would want to make the codes a separate type, probably with a
pattern restriction and a comment about the representation being used.
Any comments in general about approaches to take to this part of schema
modelling?
Nick 3 1742
Your question seems to be basic data representation best-practice.
Unless human-readability is your primary goal, I would suggest you use a
value that can be parsed directly rather than having to be recalculated
before use (hence 0.05125 is probably preferable).
Monetary values will probably need to be tagged with currency, unless
you're going to standardize on one as the official price and calculate
the others based on current exchange rates.
In other words, it's essentially the same questions as in any other data
file.
Nick wrote: If you are modelling something like interest rates, there is a choice of how you represent that interest rate. For example you could represent an interest rate of 5.125% as "5.125", or you could represent the rate as "0.05125".
Percentages are evil. They shouldn't be, but long experience suggests
that they keep causing errors. Use ratios.
There is the trade off. Humans on the whole prefer percentages (it is
domain specific) and that aids the readability.
However if you look at a lot of financial apps, then the decimal makes
a lot more sense, particularly as this would
be the preferred internal representation. ie. No maths to convert on
the way out.
On schema design, personally I don't like attributes. However for meta
data, I think they do make sense. So here
putting the type of representation out as a attribute makes sense.
There is still the option of having multiple coupons and using an
attribute / element to say what the representation is.
<interest_rat e>
<decimal>0.0512 5</decimal>
<percentage>5.1 25</percentage>
</interest_rate>
or
<interest_rat e>
<rate representation= "decimal">0.051 25</rate>
<rate representation= "percentage">5. 125</rate>
</interest_rate>
Nick This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DrUg13 |
last post by:
In java, this seems so easy. You need a new object
Object test = new Object() gives me exactly what I want.
could someone please help me understand the different ways to do the
same thing in C++. I find my self sometimes, trying
Object app = Object();
Object *app = Object();
Object app = new Object();
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their code
was littered with document.all and eval, for example, and I wanted to create
a practical list of best practices that they could easily put to use.
The above URL is version 1.0 (draft) that resulted. IMO, it is not a
replacement for the FAQ,...
|
by: |
last post by:
I have an app that retrieves data from an Access database. At the moment I
have the SQL string as a Const in my app. I understand this is not best
practice. I don't want the user to have access to read or modify this string
so I don't want to store it in an INI / Text file or in registery. Can
someone please tell me the best practice for this.
Thanks
Mike
|
by: Fredrik Melin |
last post by:
I have a "Inventory" Object that contains the product and all its fields.
The problem is that I am getting soooooo many functions under main Inventory
class so it becames impossible to initalize a new programmer into this code.
For sample, I have Add_AllowAccess, Add_DisallowAccess, Remove_AllowAccess,
Remove_DisallowAccess, Get_AllowAccess, Get_DisallowAccess (this is only a
sample)
I would really like
|
by: Ren |
last post by:
Hi All,
I'm still rather new at vb.net and would like to know the proper way to access
private varibables in a class. Do I access the variable directly or do I use
the public property?
public class MyClass
private _variableName as integer
public property VariableName as integer
| |
by: Jay Wolfe |
last post by:
Hello,
I'm trying to make sure I use best practices (and hence save myself some
headaches) with the declaration and definition of global variables. Let's
say I have an app with 30 files, including main.cpp I have global
variables that need defining in main.cpp and declaring in all other files
in. The way I've seen it done is to define/declare everything in one header
file (e.g. globalincludes.h) prefaced with the word EXTERN
...
|
by: Ned Balzer |
last post by:
Hi all,
I am pretty new to asp.net; I've done lots of classic asp, but am just
beginning to get my mind wrapped around .net.
What I'd like to do is include some code that tests if a user is logged
in, on each and every page, and redirects the user to a login page if
s/he's not logged in. The login page will also take care of some
standard setup, such as choosing/populating a user profile. I used to
use <!-- #include ... --for this,...
|
by: MikeG |
last post by:
When creating a class library is it wrong or not a 'Best Practice' to
reference a property of an object from within a constructor or method of
that object? I recall being told not to do this but I really don't
understand why. Any insight would be greatly appreciated.
Here is an example of what I mean...
namespace ClassLibrary
{
public class MyClass
{
|
by: kbutterly |
last post by:
All,
I have a menu which contains Category as the master and Product as the
child.
When I click on a Category in the menu, I want one formView control,
fvpc, to show, and then when I click on a Product, I want a different
formview, fvp, to show.
Is it best to have the two forms on separate pages, productView.aspx
|
by: =?Utf-8?B?QW1tZXI=?= |
last post by:
I've read many incomplete opinions about the "Best Practice" for securely
accessing SQL but what I really need to find the "Best Practice" that fits my
applications needs.
Currently (alpha stage) I am Using a .Net DSN-Less SQLConnection method in
my client program (vb.net) and sending uid/pwd across the network. The
client only
calls upon the stored procedures to access the tables in SQL 2005.
This is a semi commercial application...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |