One Master Class Or Lots Of Dumb Classes

Developers,
I want to go about the best way to design a generic system. Lets say the app is a simple chart axis. You have 3 classes - ticks, labels and a axis.
My question to you is theres a few ways to go about doing this.
1) Draw all the ticks
2) Draw the labels
Finish.
/*Second Approach*/
1) Draw the tick then the label and repeat for all.
What really pissed me off was this:
Is it better to have lots of dumb classes and one clever class doing all the work to support RESUABILITY. For example should a label know where to draw or should it expect its coordinate system to have been set by its caller. Or should the label know its position on the page and therefore not rely on one class getting bogged down by doing do much.
Think carefully about this. On the one hand lets say the axis now becomes a bezier path we'll have to reimplement the whole clever axis class - but the dumb classes stay as is. On the other hand it doesnt quite justify a new class to do what a Java Class already class is.
Think about this as a layout manager. When adding a button to a layout manager, the layout manager does the placing. The button is essentially a dumb class in this case.
Any help greatly appreciated

Developers,
I want to go about the best way to design a generic system. There's isn't a "best" way, and there is no such thing as a generic system.
The most universal advice you'll hear is to use Model-View-Controller separation. Start with that and see if you can do it effectively in your little charting program. It'll be harder than you think, I'll bet.
Lets say the app is a simple chart axis. You
have 3 classes - ticks, labels and a axis.
My question to you is theres a few ways to go about
doing this.
1) Draw all the ticks
2) Draw the labels
Finish.
/*Second Approach*/
1) Draw the tick then the label and repeat for all.
What really pissed me off was this:You have a short fuse. Why does this piss you off? Who are you angry with?
Is it better to have lots of dumb classes and one clever class doing all the work to support
RESUABILITY. Gotta use it once to be able reuse it. I think the point should be to try to design something that you can use well once before you start worrying about that. You'll rewrite that system three times before you can start to see how to write something generic enough for all three.
For example should a label know where to
draw or should it expect its coordinate system to have
been set by its caller. Or should the label know its
position on the page and therefore not rely on one
class getting bogged down by doing do much.
I think it's more important to design to interfaces and use patterns well.
Think carefully about this. I always try to think carefully before I answer.
On the one hand lets say
the axis now becomes a bezier path we'll have to
reimplement the whole clever axis class - but the dumb
classes stay as is. On the other hand it doesnt quite
justify a new class to do what a Java Class already
class is.I think the point is that if you design with an axis interface and factory method you'll be able to configure this part of the applicaiton in lots of ways that you didn't anticipate on the first day.
But perhaps it's best to get your XY plotting package working with rectangular coordinate systems first. After all, I've never seen a curvilinear coordinate system based on Bezier curves or b-splines. However, I have seen those constructs used to approximate and plot data.
Think about this as a layout manager. When adding a
button to a layout manager, the layout manager does
the placing. The button is essentially a dumb class
in this case.A button isn't "dumb". It's doing what it was designed to do, and does it well. It generates events that are processed by the AWT/Swing event queue. There's a lot going on there that's hidden from you.
Or maybe not so well-hidden. Go back to javax.swing.JButton and look at all the methods attached to your "dumb" button. There's a lot of design and thought there.
Any help greatly appreciatedGo back and read some books about design patterns.

Similar Messages

  • Transfer assets from one asset class to another having different depreciation keys.

    Hi Gurus,
         I am a noob in FICO, and I am facing a problem while transferring assets from one asset class to another.
    Below is the scenario.
    I created two assets 100000000000-0 under asset class 4690a and 200000000000-0 under asset class 4690b. And I am trying to transfer the
    asset from class 4690b to 4690a by selecting the option ‘New Asset’ in the transaction ABUMN. While doing this, I am receiving an error message as below.
    'Posting with trans. type 300 not possible (No acquisition posted).'
         Message No. AA324.
    Diagnosis:
         Transaction type 300 belongs to a transaction type group, which can only be used to post to assets to which posting has already been performed. However, no postings have been made to this asset.
    Procedure:
         Use a transaction type from a transactio type group, which can be used for the first acquisition to an asset.
    The error is related to the transaction type which I hadn’t explicitly created anywhere. But, when checked in transaction AO76, the transaction  type 300 belongs to the transaction type group 30. In this group I am not able to find any solution related to the error.
    Moreover, in some of the threads in SCN, I read that modifying the transaction type group might lead to something fatal.
    Kindly help me in the below.
    1. What exactly the error message is related with?
    2. Is there any other method to transfer the asset to another class?
    Please let me know if any further details are required regarding the scenario.

    Hi ,
    I understand that you want to transfer the old asset to new asset with different asset class with different depreciation keys and the old asset is not yet capitalized and does not have any Asset Values.
    Assuming that since the First Asset is not yet capitalized, that seems to be that its just that ASset Master is created and no Asset Values appear in the Asset.(in other words no acquisition, capitalization, no dep. start etc.)..
    Alternatively this asset can be advised to be blocked and flagged for deletion and create a new Asset in the new Asset Class and then capitalize the new asset by doing the acquisition according to the business process i.e. either via PO based process(GR) or Non PO based process.
    The transfer of asset is required incase the old asset still have the values and you are transferring the old asset to new one with the left over values.
    Also would request you to kindly share some screenshots of the AW01n of the old asset and screenshots of the AS03 to have more idea on it and provide a better solution to the same..
    Warm Regards,
    Vineet

  • One valuation class per G/L account

    Hello gurus,
    is it correct that if I want to differentiate my account determination by material, I will have to create one valuation class for every G/L account used and then assign those classes to my materials?
    And second question: Is it correct that I can assign valuation classes to materials or material types only? So I cannot group several materials using the same G/L account on any other level?
    Thanks in advance
    Alicia

    Hi
    To refine it a bit.
    If you have 10 Inventory Accounts maintained in the Chart of accounts then you create 10 Valuation classes
    Inventory Account means in whih you load the Stock value not the Consumption
    Accounts
    You can assign 1 valuation class to n - Similat type of materials .
    or based on your requiremnt you can maintain 1 : 1 relation ship also.
    You can ssign the valuation class to the Material group in
    SPRO-> IMG-> MM- > Purcahsing-> Material Master-> Entry Aids for Items Without a Material Master . This is done if you are not using material master
    Thanks & Regards
    Kishore

  • How to use equipment master class

    Hi Guys
    I am new to OOPS programming. I need to use the equipment master class EBINFO to retrieve the vendor extended warranty date which is a characterstic of this class. I looked in se24 but couldnt find this class. Please tell me how can I look it up so that I can use a where use and find hoew is it used
    all help will be appreciated
    rthansk

    Hello Sameer
    I am not really sure about what you are looking for. However, perhaps one of the following classes may be useful:
    - CL_REEX_EQUI (Equipment (EQUI))
    - CL_IBASE_R3_EQUIPMENT (IBase: Equipment)
    - CL_REBD_EQUIPMENT (Equipment (EQUI): Standard Impl. -> RE-FX)
    Regards
      Uwe

  • BADI to populate Asset Master Class valu in Account Assignment Item Detail?

    Hi All,
    In Shopping Cart  - COST ASSIGNMENT - Account Assignment Item Details   Tab 
    we have
    Create New Asset Master Record    section  and the field
    Choose an Asset Master Class 
    I need to populate this field (Choose an Asset Master Class) with my own value.
    What BADI I can use to populate value on this field? Any ideas?
    Thanks in advance.

    Hi,
    As i told you there is no badi to do this.
    1-What you can do is to create a CUF in the accounting tab to store your asset category.
    You will then have to
    2- hide the standard field but let the standard populate it with a default value from the org structure
    3- add in the SRM iMG the cuf field for the accounting data.
    4- code bbp_doc_change_badi to populate your CUF field
    5- code bbp_driver_determine in order to call the FM to create the asset
    6- create 1 FM in ECC to create the asset (copy of bapi_fixedasset_create1)
    Hope this helps,
    Kind regards,
    Yann
    Edited by: Yann Bouillut on Apr 15, 2009 5:23 PM

  • How to pass a "object" as a prameter from one java class to another java

    hi experts, I want to know "How to pass and get object as a parameter from one java class to another java class". I tried follwoing code just check it and give suggetions..
    import Budget.src.qrybean;
    public class ConfirmBillPDF extends HttpServlet
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");
    }Here i want to pass db with simplePDFTableShow method. simplePDFTableShow is in another java class. So how can i do this.
    And also i want to know, how this obj will get.
    please help me.
    Edited by: andy_surya on Jul 14, 2010 7:51 AM

    Hi andy_surya
    what is this i am not understand
    pdfTable.simplePDFTableShow("2010","2011","1","2","1","131","102");but i am try to solve your problem try this
    qrybean db = new qrybean();
    SimplePDFTable pdfTable = new SimplePDFTable();
    pdfTable.simplePDFTableShow(db);and access like this in SimplePDFtable class update your method
    simplePDFTable(qrybean tempDB)
    // write your code
    }

  • Why only one public class in a source file?

    why we have to write only one public class in a source file?

    PhHein wrote:
    Because the JLS says so.It does?
    From section 7.6 of the JLS (third edition):
    When packages are stored in a file system (§7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:* The type is referred to by code in other compilation units of the package in which the type is declared.
    * The type is declared public (and therefore is potentially accessible from code in other packages).
    This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
    >
    To my mind, it's strongly recommending, rather than mandating, this practice. All academic of course, merely shifting the answer from "Because the JLS says so" to "Because pretty much all Java compilers say so". I don't know of any that don't enforce this, but of course, that doesn't mean they don't exist

  • Why we can have only one public class in one source file

    why we can have only one public class in one source file

    When the java compiler is run it looks for classes referenced by the classes you are directly compiling. When looking for these referenced classes it looks for source as well as class files and compiles them automatically if the coresponding class files are missing, or older than the source.
    In order to do this it must be able to work out the source file name for any given class which might be referenced from another (the rule also applies to package level access).

  • Why only one public class in one file

    why does java allows only one public class in one file?
    Why can not we have two or more public classes in file?
    Thank u.

    Note, you can have multiple inner classes.
    e.g.
    public class A {
        public static class B {   }
        public class C {   }
        private class D {   }
    }

  • Can you add one L3-class to two different policy maps ?

    Hi Experts;
                    Requirement is to have requests from outside as well as inside from different vlan Server to our Production Servers.At present all requests are coming from inside vlan via policy-map multi-match L3_XYZ.  See Example below
    policy-map multi-match L3_XYZ
    class L3_PROD
       loadbalance vip inservice
       loadbalance policy L7_PROD
       loadbalance vip icmp-reply active
    policy-map multi-match L3_OUTSIDE
    class L3_PROD
       loadbalance vip inservice
       loadbalance policy L7_PROD
       loadbalance vip icmp-reply active
    Many thanks
    Regards

    Hi Hidayat
    yes, class map alone doesn't have any deep meaning and can be reused in many policy maps. Actually policy maps can be reused too, so in your particular example you can put the same policy map on 2 different interfaces. (Sometimes it's a good idea, if requirements are the same for traffic coming from both interfaces or if requirements are diffrent - it's better to create a new one, but class-map definitely can be reused.)

  • How sholud we call one jframe class from another jframe class

    Hi
    In my application i am calling one jframe class from another jframe clas.
    how sholud we make previous jframe inactve when another jframe is invoked?(user sholud not able to make any changes on on parent jframe window when another jframe is invoked)
    Pls reply.

    Sorry for me it is not possible to change existing code,
    pls suggest me any other solution so that i can inactive parent jframe when child jframe execution is going on.

  • HOW TO TRANSFFER THE ASSET FROM ONE ASSET CLASS TO ANOTHER

    Hello,
    At the time of asset uploading ,one asset was  uploaded in a wrong asset class and now
    I want to transffer that asset from wrong asset class to right one with depriciation value. I dont know what are to be checked before transffer and what are the process to transffer.please suggest me.
    Thanks and Regards
    Debjit Roy
    Moderator: do not use CAPITAL letters and don't ask basic SAP questions

    Hi
    If you have done any posting to asset which is under wrong asset class, the same values you will post thru FB01 for values only.
    you need to transafer the asset no from one asset class to another asset class

  • Two Data models in one tile class

    Hi
    I have a requirement where two data models have to be linked by a
    common field and printed as one record in a tile. Is it possible to
    associate two models directly to one tile class.
    Or could you please tell me the work arround.
    Regards
    Ajai C

    Hi Jagjit,
    I created one report with 2 SQL queries:
    select count(*) from employees where department_id < :P_1
    and
    select count(*) from departments where department_id < :P_1
    And it worked fine. So your report should be OK. By the way, a report has just one "Data Model". It is possible to have 2 or more "Queries" in the data model.
    Navneet.

  • Can I use the inner class of one containing class by the other class

    Can I use the inner class of one containing class by the other class in the same package as the containing class
    eg I have a class BST which has inner class Enumerator. Can I use the inner class from the other class in the same pacckage as BST?

    Inner classes do not share the namespace of the package of the containing class. Also they are never visible to other classes in the same package.Believe what you want, then, if you're going to make up your own rules about how Java works. For people interested in how Java actually works, here is an example that shows why that assertion is false:
    package com.yawmark.jdc;
    public class Outer {
         public class Inner {
    }And...
    package com.yawmark.demo;
    import com.yawmark.jdc.*;
    public class Demo {
         public static void main(String[] args) {
              assert new Outer().new Inner() != null;
    }~

  • Does Apple do iPad master classes

    Morning all
    I am a new iPad 2 customer and was wondering if the apple stores do some kind of master classes so I can learn how to get the best out of this stunning piece of kit.
    I've had a look at the genius bar online but it doesn't seem to cover iPad.
    I'd be interested to hear your responses.
    Many thanks

    Morning...
    wondering if the apple stores do some kind of master classes
    They certainly do.
    You can sign up for workshops and make a reservation here >    http://www.apple.com/retail/workshops

Maybe you are looking for

  • TA48312 I'm using iTunes 11 final version on my pc windows 7 and I cannot connect to the internet with any of its feautures. why? I'll be grateful if you help,thanks in advance.

    Hi everybody, First of all I was not one of iTues users till by chance discovered its amazing features of downloading all kinds of items that help in education in particular. I set up iTunes version 8 I gusse and it was working properly either by usi

  • Photoshop CS4 file associations (Vista) - fix

    --Only tried on Windows Vista - For those who upgraded from Photoshop CS3 to CS4 and lost the ability to associate Photoshop with specific file extensions (like .jpg) because it didn't show up in the "Openwith" list.  You might want to try this fix:

  • Do I have a corrupt file?

    I am working a on a project. All footage is 1920 x 1080 601 avchd and 1920 x 1080 60p h.264 converted with mpegstream clip the project is in 2 parts. 1st part is 54 mins and change, second is 1hr 03 mins and change. I have tried exporting both self c

  • SRF compile time taking 5 hours!!!

    Hello, I am not sure if this is the right place to post this question, but I will start here. I am using a Siebel 6 install on a Win XP desktop. In the past, the srf times would take around 2 hours, now, they go upwards to 5-6 hours, which is causing

  • BT Home Hub 5 problem

    I recently got infinity 2 installed in my home on 21/3 and was told that i was able to get 51Mbps. Everything was fine over the weekend always slightly under the speed i was told, until 24/3 where i noticed that it was going a bit slow. I done a spee