梓囚徒貧圭�鮗� ○ 賜 ★ 辛酔堀貧和鍬匈��梓囚徒貧議 Enter 囚辛指欺云慕朕村匈��梓囚徒貧圭�鮗� ● 辛指欺云匈競何��
!!!!隆堋響頼��紗秘慕禰厮宴和肝写偬堋響��
he
difference between the two prices is subject to capital gains tax。
A variation of partial taxation is ine splitting�察�so that a lower tax rate is achieved。 Let¨s
say that you have a household of two people。 One of the two earns the ine�察�and the other
stays at home。 In such a case�察�the household would be taxed at the same level as a single´person
household。 Yet the two´person household has more expenses。 Thus�察�some countries allow a
household to declare a single tax�察�where in effect�察�a single earner in a two´person household is
taxed at half the rate。
When calculating the total tax�察�some countries linearly increase the taxation rate。 Typically�察 �
the linear tax rate is less for lower ines and more for higher ines。 Another approach is
to divide ine in chunks with different tax rates for each。 This means that those monies
earned up to a certain amount are taxed at a certain rate。 Monies above that amount and below
another higher amount are taxed at a higher rate。 This chunking of the amounts and rates keeps on
being calculated until a highest tax rate is reached�察�where any amounts over that upper limit
are taxed at the highest rate。
Organizing the Tax Application
As a general rule�察�in each country�察�you must pay an ine tax�察�which is calculated against your
total ine。 From your ine�察�you can deduct certain expenses�察�thus lowering your taxable
ine。 The aspects that differ from country to country are what you can deduct and the indi
vidual tax rate。 These will be addressed by the tax application we will build in this chapter。
For the tax application�察�the following features will be implemented�此�
o Define a taxable ine。
o Define a series of deductions。
o Implement a tax´calculation engine that has the ability to account for families or
single earners。
As in previous examples�察�the project structure of the taxation application will consist of
two projects�此�a console testing application and a library ponent that contains the function
ality。 The library ponent will be in a project called LibTax�察�and the testing application will
be in a project called TestTax。
Before we start coding�察�however�察�you need to understand the concepts of interfaces and
ponents。
´´´´´´´´´´´´´´´´´´´´´´Page 187´´´´´´´´´´´´´´´´´´´´´´´
CH AP T E R 7 * L E AR N IN G AB O U T CO M P O N E N TS AN D C L AS S H I E R AR C HI E S 165
Programming Using Ideas
At this moment�察�we don¨t have a clue where to start building the tax application�察�because the
problem is in the details of the implementation。 Unlike previous examples�察�where it was
possible to gauge what tests were needed�察�in this example�察�we simply do not know。 We could
start by implementing the general tax rules and then applying them to a specific system。 But
what if our general tax rule implementations didn¨t actually work out�拭�We would have wasted
time writing code that we would end up throwing out。
Consider the following situation�此�you write a series of base classes that represent a generic
taxation kernel based on the information in the ^Understanding Some Basic Tax Concepts ̄
section。 The base classes need a task�察�and thus wait for a client。 A little while later�察�an individual
from the United Kingdom desires a tax program based on the base classes。 The developers�察 �
eager to show off the usefulness of their base classes�察�implement the tax program。 The idea is
that you save time by using the base classes to implement something specific。 Without the base
classes�察�you would�察�in theory�察�have a longer development time。
Experience has shown that unless the base classes are developed from highly experienced
business analyses�察�the odds of the base classes helping you are rather slim。 What most likely
will happen is your base class code will need to be warped�察�twisted�察�and fitted to make the
program work。 The result is that if another client from another country asks for a tax program�察 �
the base classes will yet again need to be warped�察�twisted�察�and fitted to make the program work。
The managers�察�seeing this brute´force technique�察�start to realize that the monies invested in
the base classes were not such a good idea。
Who is at fault�拭�Is it the fault of the developers who created the base classes�拭�Is it the fault
of the plexity of implementing a tax program�拭�The answer is that it is the fault of the idea of
the base classes。 The original developers wanted to create base classes based on a problem that
does not exist。 It is like trying to build the foundation of the bridge across the water before you
have an idea of how many people will use the bridge and what kind of people will use the bridge。
Logically�察�engineers don¨t start building a bridge before they figure out the details of the bridge。
Yet�察�in the software industry�察�time and time again�察�we see projects focusing on developing a
general framework without having a concrete problem to solve。
I am not saying that base classes themselves are a bad idea�察�nor is the idea of developing a
general framework。 What I am saying is that to be able to develop useful base classes�察�you need
to understand the domain of the base classes。 If you don¨t�察�then you should not be writing base
classes。
But how do you gain experience in the domain to write well´designed base classes�拭�You
can start by writing down some ideas as Visual Basic constructs and then implementing the
ideas。 ing up with ideas and then implementing them is part of the development process
called test´driven architecture。
To start test´driven architecting�察�you think of the requirements and then e up with a
general solution。 In the case of our example�察�the requirement is to create a tax engine to calcu
late ine tax。 Generally speaking�察�it means figuring out what the total taxable ine is�察 �
subtracting the total deductions�察�and applying a tax rate to the remaining sum to calculate the
total tax。
In programming terms�察�the general ideas are converted into source using Visual Basic
interfaces。
´´´´´´´´´´´´´´´´´´´´´´Page 188´´´´´´´´´´´´´´´´´´´´´´´
166 CH AP T E R 7 * L E A R N IN G AB OU T CO M P O N E N TS AN D C L AS S H I E R AR C H IE S
Representing Ideas Using Visual Basic Interfaces
Think of Visual Basic interfaces as programmatic constructs you can use to jot down ideas。 When
you jot down ideas to solve a problem�察�you usually implement a bread´crumb trail approach!
you start with one idea�察�and then follow it to another idea�察�which leads to another idea�察�until
you have jotted down all of your ideas。
Your first idea is the central idea。 In our tax application�察�the central idea is the tax engine
itself。 The tax engine is used to perform a tax calculation and to pull together all of the other
pieces。 The other pieces are some nebulous things that you need to plete the tax engine。 I
like to call these other pieces dependencies。 The dependencies are ideas that you need to finish
the previous idea�察�hence the metaphor of following bread crumbs to your solution。
Ideas by themselves are designs that solve a particular problem or give an inkling of how
to solve the particular problem。 When an idea is converted into source code�察�it bees a blue
print that forces the implementation to take a certain shape。 Ideas when coded are Visual Basic
in