Design decision � attributes vs. HashMap

I want to design a few value objects to hold customer and order informations. In a later step these objects should be used by EJBs and their DAOs. I�m facing two design aproches to do this.
1) The "classical" aproach. A serializable class with the corresponding attributes + getters/setters.
2) A class holding a HashMap. For each "attribute" there is a key-value-pair added to.
Any experiences about usage, performance, maintenance, etc. would be nice.
Thanks!
-chris

Hi.
You didn't say whether you were still going to have accessors/mutators for the properties in (2). If this is the case then it's just a question of internal representation. If you're not going to have accessors/mutators (instead having put(String name, Object value) and get(String name) methods) then you are almost certainly going to cause yourself a lot of pain in maintenance and it has been my experience that this pain will be felt before you even get a first release out.
I'm always in favour of a strong object model even for these little convenience type things (maybe that's because I consider myself to be a strong semantic modeller :-). The reason for this is that Java is strongly typed and the strong typing makes itself known to you when you (or worse, the client code) has to cast the thing in the Map, but you subvert the type system somewhat when you upcast and then downcast, as you would be doing in (2).
So, we are being held to account by the type system but we're throwing away the help it would have given us.
Now, even putting that argument aside for the moment, suppose you want to refactor your code and the thing in the map is no longer what you're casting it to (this is why it's worse in the client code) which will result in a run-time exception. If instead of (2) you had done (1), then a compile time exception would have occurred.
Clearly the argument above is lessened if you are still using accessors and mutators but then it seems like such a small effort at that point to add fields for the properties.
I can't say anything about performance as such I'm afraid, other than write clean code, then measure it to see where the bottlenecks are. By 'clean' I would have to include 'semantically strong'.
Regards,
Lance
Lance Walton - [email protected]
Team In A Box - Software without Tragedy
http://www.teaminabox.co.uk

Similar Messages

  • COPA vs. BCS design decisions (ex. profitability by customer in BCS)

    We are trying to meet a business goal of identifying gross profit by customer.
    We realize "customer" as a field in BCS is problematic, so we are thinking of only storing certain customers in BCS with a catch-all "Others" customer - with the goal of keeping the BCS data volume reasonable.
    Consider the scenario: US company sells material X qty 1 to Spain company for 100 with cost of 30 (therefore profit of 70)
    Spain sells same material X qty 1 to third-party customer for 120.
    Spain from a local perspective profits 20, however the group from an overall perspective profits 90 ( the US revenues of 100 eliminate against the Spain COGS of 100 so you are left with revenue of 120, COGS 30, profit 90 - from the group perspective ).
    We want to know how to see, on a customer level, the 90 profit from these transactions. 
    We do not believe COPA can do this, can this may be accomplished in BCS? 
    If you do a "one-sided" elimination (elimination driven by the revenue side only) of the intercompany revenue the system would not be able to reference customer on the elimination. We are wondering if this scenario of analyzing overall profit by customer can be accomplished by BCS functionality and are particularly interested in knowing what functionality you used to accomplish this requirement and in what sequence within the BCS close (BCS monitor).
    Thank you in advance for any input you may have.
    Also we are interested in any opinions/comments anyone may have about design decisions regarding BCS vs. COPA in BW.  BCS business content identifies a sample design for a BCS data model including item, company, movement type, trading partner, functional area, etc.  COPA (as configured in R3/ECC and extracted to BW) commonly features analysis by customer, material, etc.  Considering BCS features elimination functionality, what design concerns have people faced with respect to fields that they include in both reporting systems?  Obviously a prominent concern is sizing of the systems, but what common characteristics has anyone decided to feature in both systems? What considerations drove the decisions as to what common characteristics to feature in both BCS and COPA?

    Hi John,
    Reg, your last question - might be useful info in here, if you have not seen it yet:
    Re: Reports using COPA cube, BCS Cube

  • JPA Arhitectural Design Decision

    Hi,
    I'm building a 1 tier web shop, using mostly Ajax, Servlets and JPA and I need your advice on a design decision.
    When a user demands to see the products belonging to a particular category of products, my DAO object returns to the servlet a java.util.List<Product>, where Product is a JPA entity. In the servlet class I "manually" create the Ajax XML response, the user gets to see the products, everything is nice and great.
    I am not happy with the fact that the list of products remains detached in the servlet class, sort of say, and when another user demands to see the same products another list gets greated. These are objects that have method scope, but still they are on the stack, right? For 100 users who want to see 100 products each, the no. of objects created could cause the application to have a slower reponse time.
    So my question is about the design of the application.
    I obtain the list of products in the servlet class and construct the XML response. Right before sending the response, should I pass the list of products back to the DAO, and ask the EntityManager to merge the products? Will this reduce the no. of objects my application creates? Shouldn't I do this because I'm merging entities that have not been changed and the merge operation is time consuming?
    Should I not pass back the products to the DAO and set each product in the list to reference null and call System.gc() ?
    Keeping in mind, that my main concern is application response time, not reduced development time, are there any other suggestions you can make?

    first of all, a merge is only used to synchronize a changed entity that is not managed by an entity manager with the database. Why did you even come to the conclusion that you might need this?
    No you don't nullify the entities in the list. You let the entire list go when you are done with it. Manually nullifying can hinder the garbage collector, just don't do it unless you have a very good reason for doing so.
    Your main problem seems to be that you don't like the fact that you are fetching 100 objects for both users, putting duplicate objects in memory on the server. Are you sure this is a problem? You shouldn't be thinking about optimizations while you are still developing you know. I would wait until you are done, then profile the application to see where bottlenecks are; if fetching those 100 products turns out to take a lot of system resources, THEN optimize it.
    You may want to look into caching. If for example under water you use Hibernate as the persistence provider, search for "hibernate cache" using google.

  • Design decision / purpose / aim of audit trail

    Hi,
    since the audit trail doesn't contain so many data and BAM is great for real time monitoring my question is: What is the design decision, or the purpose / aim of the audit trail?
    What was the main target to implement a audit trail? Is it primarily for debugging? To see the flow the process instance has taken?
    Obviously the audit trail isn't the right way for real time monitoring, right? So maybe you can tell me, why there is an audit trail at all. What was the design decision behind it?
    Greetings
    Mike

    Hi Mike,
    While I am certainly not one of the people who designed it, I think I can answer your question.
    The audit trail is what the name implies - it keeps track of all the steps preformed by the process instance. It lets you view the instance history, variable content etc. and lets you see the current state of an in flight instance or to be more exact lets you see the last dehydration point. You can minimize the trail data, or even disable it.
    BAM however is real time monitoring of business or operational data or KPI. You send data to the BAM engine using sensors, and you only send the data you want to send when you want to send it. IF you don't need real real-time monitoring with all the fantastic visual features, alerts etc. of BAM, you can send the same data to a database or JMS server instead and built your own monitoring.
    hth,
    ~ronen

  • Questioning design decision in java.lang.Character

    Having a look at the source code for java.lang.Character, I have the Character class explicitly extends Object
    I am using jre1.6.0_07 on window XP
    Now the question is what is the reason for such a decision and we all know that any class implicitly extends Object class.
    public final class Character extends Object implements java.io.Serializable, Comparable<Character> {
    }Regards,
    Alan Mehio
    London, UK
    Edited by: alan_mehio on 24-Jul-2009 12:31

    I cannot answer with anything but personal intuition, and give non-conclusive details:
    first this is not a design decision, merely a style decision, since, as you mention, any class implicitly extends directly java.lang.Object if not explicitly extending anything else (and at the bytecode level, the source-level difference is undetectable).
    As far as style is concerned, I would have assumed that the whole JDK team is required to strictly follow consistent rules, but different classes suggest otherwise.
    Sun's public [Code Conventions for the JavaTM Programming Language|http://java.sun.com/docs/codeconv/html/CodeConventions.doc5.html#2991] do not have an explicit rule about this; section +6.4 Class and Interface Declarations+ provide an example with an extends Object clause, but the rule is not explicit in the text; and the previous section 5.2 does provide an example without this clause...
    I went on speculating that the developpers for the Character class had a special intent in mind, as they override Object methods equals() and hascode(), but other class in the same package do the same without the explicit extends Object clause (Void, System, Number). At that step I gave up trying to find a reason other than the developers' own style...

  • HELP !!!!!! Design decision...!!!!!

    Hello,
    I am in a dilemma of making a design decision . We are developing a business tier component. This is going to talk to webservices on the backend. Right now it is going to integrate with 2 different backend systems through web services. In future it might support more of such backend systems.
    And there are clients (web app, xml app) who interface with the component.
    Most of the data elements passed over to backend systems is similar for both the systems, but some are different.
    Now is it a good design to make 2 different client interfaces for 2 backend systems ? so that ,clients upfront decide which interface to use. This is more cleaner and easier implementation.
    Or is it good to have a generic interface, and component then figures out which data to use and to which backend system to talk to.
    Please help,
    Thanks

    There are several patterns that could apply, but the most widly used is probably the MVC (Model View Controller) pattern.
    With the pattern the View layer is the front end (in your case this would be the web app / xml app).
    The Controller would be your middle tier, this layer is responsible for relaying requests of the View layer to the Model layer.
    The Model layer would be your backend webservices.
    As said, the controler is responsible for relaying the requests from the view layer to the correct webservice. This means you need to have some way to know how to do this. You can employ several methods to do this.
    You could have different methods for the different webservices, this is the most straight forward way.
    Or you could look at the provided parameters and decide where you need to go based on that. This is slightly more difficult, but when you have two or more webservices that do almost the same thing, this might be the better way to go.
    If you really wanted to make things fancy, you could employt the second method and have the checks be based on rules you configure through a dynamically loaded file, this way, you could (theoratically) build your middle tier in such a way that you can add new front ends / back ends without having to redo the middle tier. This might eventually be the cleanest / best way to go, but it is also the most difficult and takes a lot of planning beforehand.
    Mark

  • Landscape Design decision

    hi,
    I have an query regarding the design decision.
    There are 2 applications at the target (both serving different division) which would receive the master data from ECC via SAP PI.
    Target structure for PI is identical for both the applications.
    Now the question is should I have only 1 application to dump the data or should connect to both application using only 1 mapping and 2 different end points.
    regards,
    Anirudh.

    Hi Gaurav,
    Thanks for your reply but I am aware of this and it is not a PI technical question.
    My question is more from a design perspective.
    If you have 2 applications serving same business but different division and can accept similar structures, should we make separate end point connection with each or let one become HUB and it can share the data to with another server.
    This way you reduce the end point connection with PI and reduce the development effort. Drawback is that it will introduce a point of failure for another server which will take data from the HUB.
    regards,
    Anirudh.

  • Archiving Design Decisions

    Hi Friends,
    I would like to know the data archiving frequency  & Design decisions for data archiving?
    Thanks in advance,
    Chandu.

    Hi Chandu,
    Frequency depends on nature and residence period of data. Application data like IDOC, Work Items and Application logs has short residence time those can be archive very frequently, whereas business data has long residence time period those can be probably archive annually or Quarterly.
    Archiving Decision depends on business’s legal and technical  retention policies.
    Regards,
    Rajnish Pathak

  • Database design: add attribute to some records of the table.

    I have table T(ID, Name, Group, <some 10 columns more>), sample data:
    1, 'a', 'group1',...
    2, 'b', 'group2',...
    3, 'c', 'group1',...
    4, 'd', 'group1',...
    5, 'e', 'group3',...Column "T.Group" puts record to some kind of logical group, some records belong to "group1" some not, as you see.
    In such situations there come business need oftenly:
    "Add to group1 T-s one additional attribute/column called A".
    Where to define column A in such situations, and is there for the decision some aspects like table T size (in rows) or other aspect that can make the design solution different?
    I understand this way, that new table S(T_ID, A) should be created for this business need. The column A should not be created in table T, that would be wrong solution because some T-records doesn't need that attribute.I understand that, if table T is small in size then it is no problem creating new child-table S, but if T would be very big table then better would be to create the column A in table T.
    Can you agree/disagree with my understanding?

    CharlesRoos wrote:
    Should i then create table called "T_details" where i would but all attributes that come with new business requirements and belongs to certain T-records?
    Or do you suggest to add the columns only and only always to table T even if some T-records doesn't need the new attribute?If every master records(rows) will have only one child records(it means one to one relationship) then only add new column else if there will one to many relation ship then create new table(child)

  • How to disable process design time attributes WS RM

    Hi,
      I recently configured a NW BPM test scenario which works as expected. When I tried to test/call BPM Process using SOAP UI/Webservice client I am unable to send a message to SAP BPM process due to WS RM & WS A are activated at design time. While developing scenario in NWDS how can I disable the properties WS-RM & WS A for start event trigger as this acts provider WSDL for Webservice client . Thank you in advance.
    Thank you,
    Mallik

    Hi Mailk,
    Any/every asynchronous web service developed in the ESR and then imported from ESR into NWDS will have properties added to the WSDL on import by the design time. The attributes are tagged as shown below.
    <ifw:properties xmlns:ifw="urn:com-sap:ifr:v2:wsdl">
    On deployment, these attributes trigger the SOA infrastructure to generate the service endpoint interface as WS-RM. These properties cannot be changed in the runtime SOA configuration as they are not editable. 
    If you want to develop the services in the ESR and then deploy them without WS-RM there are two options.
    a) copy-paste the wsdl out of the ESR perspective (the raw WSDL text) and create a local document with same name and then import the WSDL from the file system in NWDS
    b) import the WSDL from ESR and then manually remove all the <ifw: properties/attributes, then save the WSDL.
    My preference is to develop the service in the ESR (as all services should be) and then import and remove the tags. But the copy-paste and create a local WSDL is less error-prone. In any event you'll need to document the WSDL so that down the road anyone who might modify the service would know that it has been further adapted outside the standard tooling. The <ifw: attributes also control other runtime properties such as authentication, so please do some homework on services deployed with and without the tags so you can see for yourself and really understand the service endpoint generation.
    regards, Nick

  • Design decision: good to use delete cascade in database?

    Hello,
    Suppose there are two tables: customer and address.
    These two tables are linked as one (customer) to many (address), and delete cascade. Every time when the application deletes a customer record, the linked address(es) will be deleted as well.
    For my opinion, this is good because of performance and less coding.
    But bad for maintenance, since the address is implicitly deleted, the developer may not know this in advance if the system is not documented well.
    What is your opinion? What facts will affect your decision to use it or not?

    The design should say that when a customer record is deleted, the linked address records must also be deleted. Otherwise your database loses referential integrity.
    So for me, if the database supported cascading deletes, I would use them. Why would I do extra programming which the database is offering to do for me, especially since my version of the code is likely to be less robust than the database's version? The only exception would be if some other action needed to be taken besides just deleting the dependent records, and that action couldn't be handled within the database.
    As for your comments about maintenance, it's true that if the system is not documented then developers may have difficulty in maintaining it. However I don't exactly foresee designers saying to themselves "Oh, this system isn't well documented so I won't use Feature X".

  • PlanAhead - unable to open design - security attributes in generated netlist

    Hello,
    I am using ISE and PlanAhead 14.3 and the design goes fine inside just the ISE flow,
    but does not open in PlanAhead at all when I try to analyze or floor plan the device.
    The exact message is:
    ERROR: [Designutils 20-396] Could not read top design file *.ngc because ngc2edif command failed wit the following message:
    ERROR:NetListWriters - The design contains secured core(s). Creation of the output netlist is prohibited. A license for the secure IP is required from Xilinx.
    My third party IP core provider claims that the issue is known in PlanAheadTM 12.4/13.1:
    "PlanAhead can only be used pre-synthesis with the EtherCAT IP Core (e.g. for pin planning), because
    PlanAhead does not support the security attributes in the generated netlist like ISE. Xilinx is aware of
    this issue."
    My question is: Is that issue still not solved?
    This is a crucial issue for me because I can not easily floorplan or use partitions for my design at the moment.
     

    I'm having exactly the same problem (can't floorplan due to secured core).
    if I understand this answer record correclty, that workaround will only prevent the warning: it won't solve that PlanAhead doesn't show placement results for secured cores.  This will make it very difficult to verify the floorplanning was successful or any idea of how well its going.  It does not solve the problem.
     

  • Designer Entity-Attribute 'Description' storage - where is it?

    I'm searching for the Oracle Designer table that holds the Entity-Attribute 'Description' text.
    I've found the Entity-Attribute 'Notes' in the CI_ATTRIBUTES table but haven't located the 'Dscription'.
    I'm also having trouble locating the 'Description' text for Entities.
    My intent is to move all of the text from the 'Description' to the 'Notes' and migrate the text in the 'Notes' field forward. This would be a lot of cut and paste work if done in Designer.
    -Ken

    Hello
    this info is in the generoc cdi_text view available. Txt_type = 'CDIDSC'
    Regards Erik

  • Designer Entity-Attribute 'Description' storage - where?

    I'm searching for the Oracle Designer table that holds the Entity-Attribute 'Description' text.
    I've found the Entity-Attribute 'Notes' in the CI_ATTRIBUTES table but haven't located the 'Dscription'.
    I'm also having trouble locating the 'Description' text for Entities.
    My intent is to move all of the text from the 'Description' to the 'Notes' and migrate the text in the 'Notes' field forward. This would be a lot of cut and paste work if done in Designer.
    -Ken

    Please ask this question in the Oracle Designer forum: Designer
    This is the Oracle Designer Headstart forum. Orade Designer Headstart is a productivity booster for Oracle Designer. Your question is about the internal structure of the Designer repository.

  • Query Design - Keyfigure attribute in the calculation

    Hi,
    I have an infoObject with "Standard Balance" (a key figure) as an attribute. InfoObject has been added to the InfoCube.
    In my InfoCube I have another Keyfigure called "Actual balance".
    Now, in the query I would like to check the difference between the two (Actual Balance - Standard Balance). If this difference is positive, then I would like to display the row, else, I don't want to display it at all...
    Any suggestions/ideas are appreciated.
    Thanks
    John

    1- to capture the KF-attribute in the query, create a formula variable of type replacement path (go into the formula designer and create a new formula.. it's pretty straightforward)
    (http://help.sap.com/saphelp_nw04/helpdata/en/03/6ba03cc24efd1de10000000a114084/frameset.htm)
    2- the create a CKF or formula to calculate the difference between the 2
    3- use a condition to filter on your new CKF/formula from step 2 to show only the rows where this calculation is positive
    (http://help.sap.com/saphelp_nw04/helpdata/en/43/b57138c1afbd20e10000009b38f889/frameset.htm)

Maybe you are looking for

  • Can you "combine" criteria for 2 or more fields on a Selection Screen?

    Good day everyone, Here's my question:  I understand that I can put fields on a Selection Screen and pre-fill them with data values.  In this particular case, I want to pre-fill a couple of hidden fields with data values that will be used as criteria

  • Wont edit or play from external drive

    I've been using mac for about 4 years now, and have been making videos (mostly skateboard) during that 4 years. My normal plan of action in making a video is record, dump to my external through the iMovie import and then edit from that same file. Up

  • OEL4 64bit and 9i DB

    Dear Experts I am using Oracle Enterprise Linux 4 update 8 x86_64bit. After installing compat-libcwait-2.1-1.i386.rpm i am facing following error at every command. Oracle 9i successfully installed. please suggest me the way to get rid of this error.

  • SAP ECC 6.0 Software

    Hi all, I want to install ECC 6.0 but am a bit confused as to the software pack involved in doing so. I see there is an ERP 6.0 and SAP NetWeaver 7.0 (2004s) and was wondering if you could please let me know as to which instillation pack should be us

  • Websites asking for sky router password

    I tried to go onto youtube but a small box appears (as another window) and asks for my SKY router username and password. I didn't enter but when I cancelled the box it came up with a pink screen with '401 Unauthorized'. Earlier today I had the same i