Best Practice Interface Tag or Class Method

Hi All,
Just wondering which would win out in terms of efficiency, a tagging interface (say for e.g. "Containable") and then calling:
if (obj instanceof Containable)or a method in the relevant subclass (which extends throughout a tree of other classes as you'd expect) such as:
obj.isContainable()The interface would seem to win out in terms of ease of typing, but will it be more efficient in terms of performance?
Thanks,
Geoff

GeoffC wrote:
Thanks for the replies and information.
I've seen similar statements before, which is one of the motivations for the original question. If we're required to identify real-world qualities of an object then we cannot escape designing to enable that identification.I'm not clear what you mean by "real world qualities" but, for the most part, we don't need to identify objects because we wouldn't have an object in a given reference unless it had the qualities expected of that class of object.
When it gets too messy to put all the variance of processing of sub-classes in the class itself the Vistor Pattern sometimes comes to our rescue.
If we're talking about objects that can have a series of "aspects", as might occur in a game with something which models a game-world "object" we might have what's been called a "cookie jar". Essentially you have a method like:
public <T> T getAspect(Class<T> aspectClass);If the object doesn't support have the aspect it returns null, if it does it returns an implementation of the interface which represents the aspect.

Similar Messages

  • Best practice for Tags

    Hello,
    In packaged applications Tags are used in most of the Apps. Eg. in Customer Tracker App, we can add tags to a customer where these tags are stored in a varchr2 column in the Customers Table.
    In my case, I have predefined tags for Properties (Real Estate) in a lookup table called TAGS . Eg, Full floor, Furnished, Fitted, Duplex, Attached... What is the best Practice to tag the properties:
    1- To store these tags in a varchar column in PROPERTIES table using Shuttle box.
    OR
    2- To store them in a third table Eg, PROPERTIES_TAGS (ID PK, PROPERTY_ID FK , TAG_ID FK ), Then use LISTAGG function to show the tags in one line in the Properties Report.
    OR
    Do you have a better option ??
    Regards,
    Fateh

    Fateh wrote:
    Hello,
    In packaged applications Tags are used in most of the Apps. Eg. in Customer Tracker App, we can add tags to a customer where these tags are stored in a varchr2 column in the Customers Table.
    In my case, I have predefined tags for Properties (Real Estate) in a lookup table called TAGS . Eg, Full floor, Furnished, Fitted, Duplex, Attached...These appear to me to be two different use cases. In the packaged applications the tags allow end users to attach free-form metadata to data for their own purposes (these are sometimes called "folk taxonomies"). Users may use tags for different purposes, or different tags for the same purpose. For example, I might add "Monday", "Thursday" or "Friday" tags to customers because those are the days they receive their deliveries. For the same purpose you might tag the same customers "1", "8", and "15" using the route numbers of the trucks making the deliveries. You might use "Monday" to indicate that the customer is closed on Mondays...
    In your application you are assigning known, predefined attributes to the properties. This is a standard 1:M attribute model. Displaying them using the tag metaphor does not make them equivalent to free-form user tags.
    What is the best Practice to tag the properties:
    1- To store these tags in a varchar column in PROPERTIES table using Shuttle box.If you do this, how do you:
    <li>Efficiently search for furnished duplex properties?
    <li>Globally change "fitted" to "built-in"?
    <li>Report the number of properties, broken down by full floor, duplex, fitted...
    OR
    2- To store them in a third table Eg, PROPERTIES_TAGS (ID PK, PROPERTY_ID FK , TAG_ID FK ), Then use LISTAGG function to show the tags in one line in the Properties Report.As Why to use Look up Table, this the correct way to do this. It enables the data to be indexed for efficient retrieval, and questions like those above should be handled simply using joins and grouping.
    You might want to investigate the possibility of eliminating the ID PK and using an index organised table for this.
    OR
    Do you have a better option ??I'd also look carefully at your data model. Ensure you're not flirting with the EAV anti-pattern. Should some/all of these values not simply be attributes on the property?

  • Best practice for calling application module methods and plsql code

    In my application I am experiencing problems with connection pooling, I seem to be using a lot of connections in my application when only a few users are using the system. As part of our application we need to call database procedures for business logic.
    Our backing beans, call methods on the application module which in turn call a database procedure. For instance in the backing bean we have code like this to call the application module method.
    // Calling Module to generate new examination/test.
    CIGAppModuleImpl appMod = (CIGAppModuleImpl)Configuration.createRootApplicationModule("ky.gov.exam.model.CIGAppModule", "CIGAppModuleLocal");
    String testId = appMod.createTest( userId, examId, centerId).toString();
    AdfFacesContext.getCurrentInstance().getPageFlowScope().put("tid",testId);
    // Close the call
    System.out.println("Calling releaseRootApplicationModule remove");
    Configuration.releaseRootApplicationModule(appMod, true);
    System.out.println("Completed releaseRootApplicationModule remove");
    return returnResult;
    In the application module method we have the following code.
    System.out.println("CIGAppModuleImpl: Call the database and use the value from the iterator");
    CallableStatement cs = null;
    try{
    cs = getDBTransaction().createCallableStatement("begin ? := macilap.user_admin.new_test_init(?,?,?); end;", 0);
    cs.registerOutParameter(1, Types.NUMERIC);
    cs.setString(2, p_userId);
    cs.setString(3, p_examId);
    cs.setString(4, p_centerId);
    cs.executeUpdate();
    returnResult=cs.getInt(1);
    System.out.println("CIGAppModuleImpl.createTest: Return Result is " + returnResult);
    }catch (SQLException se){
    throw new JboException(se);
    finally {
    if (cs != null) {
    try {
    cs.close();
    catch (SQLException s) {
    throw new JboException(s);
    I have read in one of Steve Muench presentations (Oracle Fusion Applications Team' Best Practises) that calling the createRootApplicationModule method is a bad idea, and to call the method via the binding interface.
    I am assuming calling the createRootApplicationModule uses much more resources and database connections that calling the method through the binding interface such as
    BindingContainer bindings = getBindings();
    OperationBinding ob = bindings.getOperationBinding("customMethod");
    Object result = ob.execute()
    Is this the case? Also is using getDBTransaction().createCallableStatement the best way of calling database procedures. Would it be better to expose plsql packages as webservices and then call them from the applicationModule. Is this more efficient?
    Regards
    Orlando

    Thanks Shay, this is now working.
    I successfully got the binding to the application method in the pagedef.
    I used the following code in my backing bean.
    package view.backing;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    public class Testdatabase {
    private DCBindingContainer bindingContainer;
    public void setBindingContainer (DCBindingContainer bc) {this.bindingContainer = bc;}
    public DCBindingContainer getBindingContainer() {return bindingContainer;}
    public static String validateUser()
    // Calling Module to validate user and return user role details.
    System.out.println("Getting Binding Container from Home Backing Bean");
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    System.out.println("Obtain binding");
    OperationBinding operationBinding = bindings.getOperationBinding("calldatabase");
    System.out.println("Set username parameter");
    operationBinding.getParamsMap().put("p_userId",userId);
    System.out.println("Set password parameter");
    operationBinding.getParamsMap().put("p_testId",examId);
    Object result = operationBinding.execute();
    System.out.println("Obtain result");
    String userRole = result.toString();
    System.out.println("Result is "+userRole);
    }

  • Best practice: interface for editing documents

    Hello
    I use IDeveloper 11g 11.1.1.3.0, ADF Faces
    I have got a task to create a web interface for editing documents.
    Every document have a head and a specification.
    Head have a lot of field, and every row in a specification have a lot of fields also.
    There are few PL/SQL procedures I need call to save document in the database, and I need to call them in the single transaction for it.
    So, I need to fill up all document and only after that save it to the database.
    For fill up some of fields I need to use component like List of Values (with autoSuggestBehavior and with selecting value from the list).
    There is next question: what is the best practice to develop interface like this?
    I had some troubles when I tried to use ADF BC.
    May be, there are tutorials?
    Will be very thankful for any advices or links.
    Anatolii

    Hello
    I use IDeveloper 11g 11.1.1.3.0, ADF Faces
    I have got a task to create a web interface for editing documents.
    Every document have a head and a specification.
    Head have a lot of field, and every row in a specification have a lot of fields also.
    There are few PL/SQL procedures I need call to save document in the database, and I need to call them in the single transaction for it.
    So, I need to fill up all document and only after that save it to the database.
    For fill up some of fields I need to use component like List of Values (with autoSuggestBehavior and with selecting value from the list).
    There is next question: what is the best practice to develop interface like this?
    I had some troubles when I tried to use ADF BC.
    May be, there are tutorials?
    Will be very thankful for any advices or links.
    Anatolii

  • Looking for best practice sending args to classes

    Unfortunately, I'm stuck in a company that only employs MS developers, so I'm kind of stranded with no buddies to mentor my java skills... so thanks in advance for any help, I appreciate it.
    Anyway, I think that I've been doing things the hard way for a while and I'm looking for some sort of best practice to start using. I'm currently working on a GUI that will take all the selections, via combo boxes, text fields, etc., and send them to a class (a web bot, actually) and run it.
    I'm starting to run into the problem of having too many arguments to send to my Bot class. What's a good way that I should be doing this? I figure I can do it a couple of ways, right?
    new Bot(arg1, arg2, ......... argX);
    Bot bot = new Bot();
    bot.setArg1("something");
    bot.setArg2("something");
    etc..
    bot.run();Or, is there a better way? Can I package all the args in a collection somehow?? That way I only have 1 argument to send... I don't know... Thanks for the help.

    Create a class "Data" (for example) that encapsulates all the data you want to pass to the Bot class. Then create an instance of the Data class and set all the relevant fields (i.e. setArg1 etc). Now you pass this Data instance to your Bot class. This way you only have to pass one Object around and you've encapsulated all your data.

  • Best practice to handle the class definitions among storage enabled nodes

    We have a common set of cache servers that are shared among various applications. A common problem that we face upon deployment is with the missing class definition newly introduced by one of the application node. Any practical approach / best practices to address this problem?
    Edited by: Mahesh Kamath on Feb 3, 2010 10:17 PM

    Is it the cache servers themselves or your application servers that are having problems with loading classes?
    In order to dynamically add classes (in our case scripts that compile to Java byte code) we are considering to use a class loader that picks up classes from a coherence cache. I am however not so sure how/if this would work for the cache servers themselves if that is your problem!?
    Anyhow a simplistic cache class loader may look something like this:
    import com.tangosol.net.CacheFactory;
    * This trivial class loader searches a specified Coherence cache for classes to load. The classes are assumed
    * to be stored as arrays of bytes keyed with the "binary name" of the class (com.zzz.xxx).
    * It is probably a good idea to decide on some convention for how binary names are structured when stored in the
    * cache. For example the first tree parts of the binary name (com.scania.xxxx in the example) could be the
    * "application name" and this could be used as by a partitioning strategy to ensure that all classes associated with
    * a specific application are stored in the same partition and this way can be updated atomically by a processor or
    * transaction! This kind of partitioning policy also turns class loading into a "scalable" query since each
    * application will only involve one cache node!
    public class CacheClassLoader extends ClassLoader {
        public static final String DEFAULT_CLASS_CACHE_NAME = "ClassCache";
        private final String classCacheName;
        public CacheClassLoader() {
            this(DEFAULT_CLASS_CACHE_NAME);
        public CacheClassLoader(String classCacheName) {
            this.classCacheName = classCacheName;
        public CacheClassLoader(ClassLoader parent, String classCacheName) {
            super(parent);
            this.classCacheName = classCacheName;
        @Override
        public Class<?> loadClass(String className) throws ClassNotFoundException {
            byte[] bytes = (byte[]) CacheFactory.getCache(classCacheName).get(className);
            return defineClass(className, bytes, 0, bytes.length);
    }And a simple "loader" that put the classes in a JAR file into the cache may look like this:
    * This class loads classes from a JAR-files to a code cache
    public class JarToCacheLoader {
        private final String classCacheName;
        public JarToCacheLoader(String classCacheName) {
            this.classCacheName = classCacheName;
        public JarToCacheLoader() {
            this(CacheClassLoader.DEFAULT_CLASS_CACHE_NAME);
        public void loadClassFiles(String jarFileName) throws IOException {
            JarFile jarFile = new JarFile(jarFileName);
            System.out.println("Cache size = " + CacheFactory.getCache(classCacheName).size());
            for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
                final JarEntry entry = entries.nextElement();
                if (!entry.isDirectory() && entry.getName().endsWith(".class")) {
                    final InputStream inputStream = jarFile.getInputStream(entry);
                    final long size = entry.getSize();
                    int totalRead = 0;
                    int read = 0;
                    byte[] bytes = new byte[(int) size];
                    do {
                        read = inputStream.read(bytes, totalRead, bytes.length - totalRead);
                        totalRead += read;
                    } while (read > 0);
                    if (totalRead != size)
                        System.out.println(entry.getName() + " failed to load completely, " + size + " ," + read);
                    else
                        System.out.println(entry.getName().replace('/', '.'));
                        CacheFactory.getCache(classCacheName).put(entry.getName() + entry, bytes);
                    inputStream.close();
        public static void main(String[] args) {
            JarToCacheLoader loader = new JarToCacheLoader();
            for (String jarFileName : args)
                try {
                    loader.loadClassFiles(jarFileName);
                } catch (IOException e) {
                    e.printStackTrace();
    }Standard disclaimer - this is prototype code use on your own risk :-)
    /Magnus

  • Best practice for calling an AM method with parameters

    Which will be the best way to call an AM method with parameters from a backing bean.
    I usually use the BindingContainer to get the operation binding and then call execute function. But when the method have parameters, how to do it?
    Thanks

    Hi,
    same:
    operationBinding.getParamMap().put("argument1Name", argument1Value);
    operationBinding.getParamMap().put("argument2Name", argument2Value);
    operationBinding.execute();
    Frank

  • "Best practice" for accessing a class from a custom component?

    My app utilizes a simple class to hold global properties such as username, session data, and similar data. The class is initialized at app startup via code similar to: appGlobals:myGlobals=new myGlobals.
    Many of the custom MXML components and AS classes need to access that data. I have been able to work with it using Application.application.appGlobals.propertyname.
    Is this method the best way to communicate from components and classes to a class initiated at the application level, or should I learn something new before I build a lot of code on this method?
    Thanks.
    Paul

    The WizardModel class is interesting, it is a "singleton" where it is designed to only have one instance, and the class actually has a static variable of its own class. Because that variable is static, an instance is created the first time the class is accessed.
    As to where the WizardModel is "first accessed" and thus its own variable of type WizardModel instantiated, is hard to say, as you really need to understand the application and component startup lifecycle indepth. I have a certain depth of knowledge of that but not enough depth to say definitively when WizardModel  is first accessed, but here are some possibilities:
    WizardModel.wizardTitle = WizardModel.wizardTitleBase;      In the WizardController "wizardTitleChangeHandler" event handler
    creationComplete="WizardModel.app = this;"      In the Wizard.mxml main app creationComplete handler
    <mx:Panel title="{WizardModel.wizardTitle}" width="100%" height="100%">    Opening tag of Panel in Wizard.mxml
    I know its confusing, but just try to absorb what you can for now, and over time it will become gradually more clear.

  • Best Practice for Commit() after custom method on struts action

    Hi all,
    I'm curious what's the best way to commit programmatically after an application module custom method, wired to a struts action, inserts a row into a view object.
    Right now I do this:
    vo.insertRow(theRow);
    vo.executeQuery();
    getDBTransaction.commit();
    Then, I wire a struts action after the one calling the custom method, and drag a commit onto that as well. Is there a better way? I wanted to make sure...
    Thanks.

    John,
    it seems that your are commiting it twice then.
    On another issue, don't program directly against View objects in your Struts Action. Write a method on the YourApplicationModuleImpl class and expose this to the client. Have this method handle the update and commit on the server. In the Action simply call the method exposed method from the YourApplicationModule.
    Frank

  • Best practice of re-use a method in constructing a JFrame

    Hello All,
    I constructed a Main JFrame with the help of following method:
         JPanel createYpanel(JLabel lbl, JComponent txt){
              JPanel pane = new JPanel();
              pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
              pane.add(lbl);
              pane.add(txt);
              return pane;
         }Now, I need the above method for constructing a Child JFrame.
    What is the best programming approach?
    (a) Create a different private JPanel createYpanel(...) {...} in the Child JFrame, although it is 100% the same as that in the Main JFrame.
    (b) Make the method in the Main JFrame as static
    static JPanel createYpanel(...) {...}, so that it can be accessed by the Child JFrame as Main.createYpanel(lblA, cmpA);(c) Keep the method in the Main JFrame as non-static, but create an instance of the Main JFrame in the Child JFrame to access the method, such as
    JFrame mn = new Main();
    mn.createYpanel(lblA, cmpA);(d) None of the above. Please give me a better approach.
    My best guess:
    option (c) is the worst, since it needs to instantiate a Main JFrame only for the purpose of accessing this method and option (a) is redundancy although it can be done quickly by copy and paste. However, I'm not sure whether making a method static for this purpose is the best approach. Can anyone confirm this?
    Thank you for your help.
    Edited by: Patrick_Stiady on Jul 11, 2009 2:13 AM

    What is the best programming approach?I'm always reluctant to qualify any programming technique as "the best" - many ways to skin the cat.
    But here's my preference.
    (b) Make the method in the Main JFrame as staticYes.
    This instance method (currently) doesn't use any state nor collaborator from the instance, only its arguments.
    So it can be static. Indeed it should be static, for the other reasons you mention (no need to create an artificial "MainFrame" instance).
    However, you could locate this method in another class (+PanelUtility+, PanelFactory, whatever). Letting it in MainFrame, and using it from ChildFrame introduces a dependency that may not be relevant (if MainFrame publishes nothing else of use to the ChildFrame).

  • Best practice for creating test classes

    I am quite new to java using NetBeans 6.1 with JDK 1.6 and for some of the functions I created I want to write test classes to run automated tests to check consistence when I do some changes.
    I read something about this topic getting confused about different approaches depending on the jdk version / netbeans version used and however found very different looking examples on the net.
    Now I am very confused how to continue. Any hint would be helpful,
    Thanks,
    Martin.

    georgemc wrote:
    Can you expand on that? I suspect you're talking about JUnit < 4 vs JUnit 4, since JUnit 4 can only work with Java versions from 5 onwards.Yes, I am talking about JUnit - On NetBeans the default was 3.8.2 if I remember right and I installed 4.1.
    The problem starts where to start; creating a JUnit Test, Test for Existing Class or Test Suite.
    Trying to create tests for an existing class it shows me something like:
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    import static org.junit.Assert.*;
    public class TestsTest {
        public TestsTest() {
        @Before
        public void setUp() {
        @After
        public void tearDown() {
    }using 4.1
    but
    import junit.framework.TestCase;
    public class TestsTest extends TestCase {
        public TestsTest(String testName) {
            super(testName);
        protected void setUp() throws Exception {
            super.setUp();
        protected void tearDown() throws Exception {
            super.tearDown();
    }using 3.8.2
    so first the versions seem to work completely different. The older version seems more understandable (for me as a beginner). Is it "save/stable" to use the already the newer JUnit? How is the support in NetBeans with the newer version - I mean do I have to expect problems not going with the older one?

  • Best Practice: Where to put Listeners?

    In a Swing application the typical way of handling events is to add a listener. So far, so good.
    But where to locate the listeners? Obviously there are a lot of possible solutions:
    - Scatter them all over your code, like using anonymous listeners.
    - Implement all of them in a single, explicit class.
    - Only uses windows as listeners.
    - etc.
    The intention of my question is not to get a rather long list of more ideas, or to get pros or cons of any of the above suggestion. My actual question is: Is there a best practice for where to locate a listener's implementation? I mean, after decades of Swing and thousands of Swing based applications, I am sure that there must be a best practice where to but listeners implementations.

    mkarg wrote:
    In a Swing application the typical way of handling events is to add a listener. So far, so good.
    But where to locate the listeners? Obviously there are a lot of possible solutions:
    - Scatter them all over your code, like using anonymous listeners.
    - Implement all of them in a single, explicit class.
    - Only uses windows as listeners.
    - etc.
    The intention of my question is not to get a rather long list of more ideas, or to get pros or cons of any of the above suggestion. My actual question is: Is there a best practice for where to locate a listener's implementation? I mean, after decades of Swing and thousands of Swing based applications, I am sure that there must be a best practice where to but listeners implementations.You've asked other similar questions about best practices. No matter how long Swing has been around, people still program in a variety of ways, and there are lots of areas where there are several equally correct ways of doing things. Each way has its pros and cons, and the specific situation drives towards one way or the other. One's best practice of using anonymous listeners will be another's code smell. One's best practice of using inner class will be another's hassle.
    So you will probably only get opinions, and likely not universally recognized best practices.
    That being said, here is my opinion (nothingmore than that, but it has a high value to me :o) :
    In yous list of options, one thing that is more likely to form a consensus against it, is "only uses window as listeners". I assume you mean each frame is implemented as a MyCustomFrame extends JFrame , and add this as listener on all contained widgets.
    This option is disregarded because
    1) extending JFrame is generally not a meaningful use of inheritance (that point is open to debate, as it is quite handy)
    2) register the same object to serve as a listener for several widgets makes the implementation of listener callbacks awkward (lots of if-then-else). See [that thread|http://forums.sun.com/thread.jspa?forumID=57&threadID=5395604] for more arguments.
    Now, no matter what style of listeners you choose, your listeners shouldn't do too much work (how much is too much is also open to debate...):
    if a listener gets complicated, you should simplify it by making it a simple relay, that transform low-level graphical events into functional events to be processed by a higher-level class (+Controller+). I find the Mediator pattern to be a best practice for "more-than-3-widgets" interactions. As the interactions usually involves also calls to the application model, the mediator becomes a controller.
    With that in mind, sort anonymous listeners are fine: the heavy work will be performed by the mediator or controller, and that latter is where maintenance will occur. So "Scatter them all over your code" (sounds quite pejorative) is not much of an issue: you have to hook the widget to the behavior somewhere anyway, the shorter, the best.
    For simpler behavior, see the previous reply which gives perfect advice.

  • Deploying Branding Files Best Practice

    Question about best practice (if exists) for deployment method of branding files.
    Background:
    I created 2 differefent projects for a public facing SP 2010 site.
    First project contains 1 feature and is responsible for deploying branding files: contains my custom columns, layouts, masterpage, css, etc...
    Second project is my web template. Contains 3 features, contenttypebinding, webtemp default page, and the web temp files (onet.xml).
    I deploy my branding project, then my template files.
    Do you deploy branding as Farm solution or Sandboxed solution? So how do you update your branding files at this point?
    1. You don't, you deploy and forget about solution doing everything in SP Designer from this point on.
    2. Do step 1, then copy everything back to the VS project and save to TFS server.
    3. Do all design in VS and then update solution.
    I like the idea of having a full completed project, but don't like the idea of having to go back to VS, package, and re-deploy every time I have a minor change to my masterpage when I can just open up Designer and edit.
    Do you deploy and forget about the branding files using SP Designer to update master pages, layouts, etc.. or do you work and deploy via VS project.

    Hi,
    Many times we use Sandboxed solutions for branding projects, that way it would minimize the dependency of SharePoint Farm administration.  Though there are advantages using SharePoint Farm solution, but Sandboxed solution is simple to use, essentialy
    limited to set of available Sandboxed solutions API.
    On the SP Designer side, many of the clients that I have worked with were not comfortable with the Idea of enabling SharePoint Designer access to their portal. SP Designer though powerful and it does some times brings more issues when untrained business
    users start customizing the site.
    Another issue with SPD is you will not be able track changes(still can use versioning) and retracting changes are not that easy. As you said, you simply connect to the site using SPD and make changes to the master pages, but those changes are to be
    documented, and maintain copies of master pages always to retract the changes. 
    Think about a situation when you make changes to the Live site using SPD and the master page is messed up, and your users cannot access the site. we cannot follow trial and error methodology on the production server.This would bring
    out more questions like, What would be your contingency plan for restoring the site and what is your SLA for restoring your site, how critical is your business data.
    Although this SPD model would be useful for a few user SharePoint setup with limited tech budget but not also advisable.
    I would always favor VS based solution, which will give us more control over the design and planning for deployment.
    We do have solution deployment window, as per our governance we categorize the solution deployment based on the criticality and for important changes we plan for the weekends to avoid unavailability of the site.
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Best Practice for Updating Infotype HRP1001 via Class / Methods

    I want to update an existing (custom) relationship between two positions.
    For example I want
    Position 1 S  = '50007200'
    Position 2 S =  '50007202'
    Relationship = 'AZCR'
    effective today through 99991231
    Is there a best practice or generally accepted way for doing this using classes/methods rather than RH_INSERT_INFTY ?
    If so, please supply an example.
    Thanks...
    ....Mike

    Hi Scott
    You can use a BAPI to do that.
    Check the following thread:
    BAPI to update characteristics in Material master?
    BR
    Caetano

  • Best practice regarding package-private or public classes

    Hello,
    If I was, for example, developing a library that client code would use and rely on, then I can see how I would design the library as a "module" contained in its own package,
    and I would certainly want to think carefully about what classes to expose to outside packages (using "public" as the class access modifier), as such classes would represent the
    exposed API. Any classes that are not part of the API would be made package-private (no access modifier). The package in which my library resides would thereby create an
    additional layer of encapsulation.
    However, thus far I've only developed small applications that reside in their own packages. There does not exist any "client code" in other packages that relies on the code I've
    written. In such a case, what is the best practice when I choose to make my classes public or package-private? Is it relevant?
    Thanks in advance!

    Jujubi wrote:
    ...However, thus far I've only developed small applications that reside in their own packages. There does not exist any "client code" in other packages that relies on the code I've
    written. In such a case, what is the best practice when I choose to make my classes public or package-private? Is it relevant?I've always gone by this rule of thumb: Do I want others using or is it appropriate for others to use my methodes. Are my methods "pure" and not containing package speicific coding. Can I guarentee that everything will be initialized correctly if the package is included in other projects.
    Basically--If I can be sure that the code will do what it is supposed to do and I've not "corrupted" the obvious meaning of the method, then I usually make it public--otherwise, the outside world, other packages, does not need to see it.

Maybe you are looking for

  • File to Web service (SOAP) to File scenario with out BPM in PI 7.1

    Hi All, I have scenario File to Web service (SOAP) to File scenario with out BPM.i am getting the below error: 1) Error MP: unexpected exception caught com.sap.aii.af.service.cpa.impl.exception.CPAObjectKeyException: Value of key must not be null: Ob

  • Reg : Error in Portal while accessing BI Report.

    Hi,    When I am trying to access BI report in the portal I got the following error  in Portal    User #### has no RFC authorization for function group SYST. Please assist to resolve the issue. Thanks, Prakash.

  • WorkBook Tables

    Hello All, Does every workbook stored in the database will have a record entry in the table "eul5_documents" ? How to get the list of users who can run a particular work book(By using Back end query)? How to know when was a particular workbook was ru

  • How do I change time axis labels?

    I have a few data plots that show some parameter on the y-axis versus time on the x-axis.  The data spans several months (sometimes years).  Currently my x-axis shows date labels for the left and right side of the plot and one value inbetween (happen

  • High lighting function disappeared from Toolbox.  Where is it?

    My highlighting function has disappeard from the tool box.  Using the help box was absolutely futile.  Now I can no longer highlight or remove highligting from text.  It says I have OS X version 10.83  I believe it is Mountain Lion