Where to put the java code - best practices

Hello. I work with the Jdeveloper 11.2.2. I'm trying to understand the best practices for where to put the code. After reviewing the http://docs.oracle.com/cd/E26098_01/web.1112/e16182.pdf, it seemed that request module was the preferred location (although many examples in the pdf file reside in the main methods). After some time of coding, if, I noticed that there was a certain libraries imported and wondered if this would impact performance.

I looked at the articles published on the forum, in particular Re: programmatically access the method of service (customer interface) . This link mentions for access to the code a bean of support - and the bulk of the recommendations seem to be using the data control to drag to the Joint Strike Fighter, or use the links to access code.

My interest lies in where to put the java code in the first place; In the view object, entity object, and... other Am, backing bean object?

I can describe several guess better know where to put the code and the advantages and disadvantages:

1. in the application module
Benefits: Central location for code makes development and support easier as there are not multiple access points. Kinda like a data control centralizes the services, the module of the application can act as a conduit for the different parts of the code you have in your model objects.
Cons: Everything in one place means that the module of the application becomes bloated. I don't know how the memory works in java - if the app module has tons of different libraries are all called when even a method of re - run a simple query is called? Memory of pigs?

2. write the code in the objects it affects. If you write code that accesses a view object, write it to a display object. Then make it visible for the customer.
benefits: the code is accessible through ducts less (for example, I expect that if you call the module from the application of a JSF backing bean, then the module of the application calls the view object, you have three different pieces of code-)
CONT: the code gets spread, more difficult to locate etc.

I would greatly appreciate your thought on the issue.


Kind regards
Stuart

Published by: Stuart Fleming on May 20, 2012 05:25

Published by: Stuart Fleming on May 20, 2012 05:27

First point here is when you say 'where to put the code of java' and you're referring to ADF BC, the point is that you put 'code of java business logic' in the ADF business components. Of course it is very good to have the Java code in the ViewController layer that covers the user interface layer. Just don't put the business logic in the user interface layer and don't put no logical user interface in the model layer. In your 2 examples you seem to consider the ADF BC layer only, so I'll assume that you're not only serious logic java code.

Meanwhile, I'm not keen on best practices in the term that people are following best practices without thinking, usually best practices come with conditions and forget to apply. Fortunately you do not here that you have thought through the pros and cons of each (nice work).

Anyway, back on topic and turn off my soap box, regarding where to put your code, my thoughts:

(1) If you have only 1 or 2 methods set in the AppModuleImpl

(2) If you have hundreds of methods, or there is that a chance #1 above will turn into #2, divide the code between the AppModuleImpl, the ViewImpl and the ViewRowImpls. Why? Because your AM will become overloaded with hundreds of methods making it unreadable. Put the code where it should logically go instead. Methods that operate on a specific line of VO Approfondissez partner ViewRowImpl, methods that work across lines in a VO enter the ViewImpl and methods that work throughout your in the associated AppModuleImpl.

To be honest that you never the option you choose, one thing I recommend as a best practice is to be consistent and document standard so not know your other programmers.

BTW, it is not a question about loading a lot of libraries/imports in a class, it has no performance cost. However if your methods require a lot of class variables, then yes there will be a memory of the costs.

On a side note, if you are interested in more ideas on how to create ADF applications properly think about joining the EMG "ADF", a forum which deals with ADF architecture, best practices (cough), deployment architectures free online and more.

Kind regards

CM.

Tags: Java

Similar Questions

  • where should I put the jquery code to

    Hi all

    New to web design, I need help...

    I need to know where to put the jquery code to... I'm trying to use ccs menu to put in a reactive navigation on my site...

    Here's the code...

    $('#cssmenu').prepend ("< div id =" indicatorContainer"> < div id ="pIndicator"> < div id ="cIndicator"> < / div > < / div > < / div > ');
    activeElement var = $(' #cssmenu > ul > li:first');

    $('_#cssmenu_>_ul_>_{li').each (function ()})
    If ($(this) .hasClass ('active')) {}
    activeElement = $(this);
    }
    });


    var posLeft = activeElement.position (.the);
    var elementWidth = activeElement.width ();
    posLeft = posLeft + elementWidth/2-6;
    If (activeElement.hasClass('has-sub')) {}
    posLeft-= 6;
    }

    $('#cssmenu_#pIndicator').css ('left', posLeft);
    var element, leftPos, flag = $("#cssmenu pIndicator");

    $("#cssmenu_>_ul_>_{li").hover (function ()})
    element = $(this);
    var l = element.width ();
    If ($(this).hasClass('has-sub'))
    {
    leftPos = element.position () .the + w/2-12;
    }
    else {}
    leftPos = element.position () .the + w/2-6;
    }

    $('#cssmenu_#pIndicator').css ('left', leftPos);
    }
    function() {}
    $('#cssmenu_#pIndicator').css ('left', posLeft);
    });

    $('#cssmenu>ul').prepend ("< li = id" menu button"> < a > Menu < /a > < /li > ');
    {ravishing (function ($(«#menu-bouton»))
    If ($(this) .parent () .hasClass ('open')) {}
    $(this) .parent () .removeClass ('open');
    }
    else {}
    $(this) .parent () .addClass ('open');
    }
    });

    The safest place to put the script is just before the end body tag-.

    Make sure that the jQuery library is loaded before the script above similar to

  • Hello, I got a serial number for adobe package I installed 3/4 years ago, but I don't know where I put the serial number and now I need it! Is anyway to find the series through the application code? Thank you!

    Hello, I got a serial number for adobe package I installed 3/4 years ago, but I don't know where I put the serial number and now I need it! Is anyway to find the series through the application code? Thank you!

    If it's a Windows machine, and then try running Belarc Advisor

    http://www.Belarc.com/free_download.html

    For a Mac, you can try:

    https://Mac-product-key-Finder.com/

    Find the serial number of your Adobe product quickly

  • Where to put the delay to show/hide code?

    Hi all.

    How can we?

    I have an item I want to delay when masking, I found a few

    things about that though, I'm having trouble finding where to put the code?

    Here is the script below without the delay. Where I would put the delay code?

    Everything I have tried does not work. He always "presents" the item but without any delay.

    sym.getComposition () .getStage ().getSymbol("Console_Content").getSymbol("console_text"). $("cons_select_text") () .show;

    Any help would be great!

    Thank you

    Hello

    This code does not work: sym.getComposition () .getStage ().getSymbol("Console_Content").getSymbol("console_text"). $("cons_select_text") .delay (1500) .show (1);

    You can use setTimeout or setInterval: Object Window

    delay() function {sym.getComposition () .getStage (.getSymbol("Console_Content")..getSymbol("console_text") $("cons_select_text")) .show ();}

    setTimeout (delay, 1500);

  • How to get the value on a model that is defined in the java code in email

    Hello

    I created a custom code and send email as well to custom component. I can send emails using the method:

    InternetFunctions.sendMailTo (EmailID, EmailTemplate, subject, cxt);

    But my problem is that I have to get a value in the model of "EmailTemplate" which are defined from java code. but I don't know how to get the value.

    I will highlight in the java code by using this code: binder.putLocal ("ErrorApproveRejectMsg", massegeBody);

    I'm trying to enhance the model using the code below, but not able to get.

    1 < $exec getValue ("#active", "ErrorApproveRejectMsg") $ >

    2 < $exec getValue ("#active", ErrorApproveRejectMsg) $ >

    3 < getValue ("ErrorApproveRejectMsg") $exec $ >

    4 < $exec getValue (ErrorApproveRejectMsg) $ >

    5 < getValue ("#local", ErrorApproveRejectMsg) $exec $ >

    6 < getValue ("#local", "ErrorApproveRejectMsg") $exec $ >

    7 < $ErrorApproveRejectMsg$ >

    8 < $exec ErrorApproveRejectMsg$ >

    Assuming that cxt will be your Service or execution context object

    You can do something like this

    DB. PutLocal ("ErrorApproveRejectMsg", "Error");

    cxt.setCachedObject ("DataBinder", db);

    PageMerger h = new PageMerger (db, cxt);

    cxt.setCachedObject ("PageMerger", h);

    InternetFunctions.sendMailTo (usersEmail, emailTemplate, emailSubject, cxt);

    where db is current databinder object, and you can put any variable custom in the workbook by using the putLocal method.

    Thank you

    Vikram

  • Where to put the cache of catalogue/cr in my configuration

    Where to put the cache of catalogue/cr for best results

    Parameters:

    Execution of lr 5 on Hi-spec laptop, catalog of 20 k cr2 files

    2 TB 7200 RPM disk internal w/photos

    m.2 128 GB SSD - average reader system

    good (also internal), 500 GB - m.2 - SSD drive, new EVO secondary

    All have 20% + free

    Thanks for any advice.

    Normally, a cache system works best when it is on another drive of source files. This means that you would normally like the LR catalog + cache on a separate disk from the original images.

    I put the pictures on the 2 TB drive.

    The 500 GB SSD seems to be a reasonable place for the catalogue and the cache, but I don't know enough about SSDS to talk about the frequent updates of file that will happen with the catalogue.

  • Hang the reply Codes to the Java code

    Hello everyone. I created the java code for IOM 11.1.1.3.0, which essentially returns a Boolean value.

    Copy the following code returns true if executed without problem, it returns false if there is a problem that prevents the completion.

    My question is this: how to map the Boolean return to reflect the response code to the IOM. If the code returns 'true' I want the resource status of 'Configured', and if it returns 'false' I want the resource to a status of "Provisioning".

    Where should I go to connect back the code to answer IOM mapping?

    Thanks in advance!

    While creating an adapter, you have added task here.
    Did you have a mapping for the OUTPUT variable?

    Also in the task of process, have mapped OUT variable with the RESPONSE CODE tab integration of this task?

    under the tab "resources status management.

    Under the status of the object map tasks

  • Where to put the script?

    I'm a bit confused on where to put the script so we are quite sure, he will be executed.

    It is my observation that my script should be in the same framework for action takes place. I can't have it just in the 1st frame (like people) and hope that it work. For example, a script runs at the start of my menu frame 1. If I move the start menu in frame 5, the script stops working until I have move the script box 5 in the same layer of the menu.

    The script does not work after that you have a keyframe. It is not postponed, correct?

    What are the General rules on set scripts to?

    Thanks for your suggestions,

    ActionScript executes as soon as the playhead passes the frame that contains the script.  If you have actionscript on frame 1 that references objects which do not exist until the frame 5, the script is still running, but because your code refers to undefined objects, those intended objects will not be affected by the script.

    running ActionScript remains in force for as long as your swf file remains open or until another script removes, replaces or it nulls.

  • Where to put the IP lease expires?

    I would like to know on where to put the IP Address of the lease, which is currently 30 minutes

    Does anyone have any suggestions?

    Thanks in advance for your suggestions :>

    Lease obtained... April 1, 2014 12:29
    End of the lease. April 1, 2014 12:59 AM

    Image
    http://I1093.Photobucket.com/albums/...ps367c6819.jpg

    In your router.  Like this:

  • WRT120N - impossible to find where to put the DNS I want to use

    I bought a WRT120N to replace a Netgear, I had.

    I can't find in the management console where to put the DNS servers, I want to use.

    Can someone give me please the exploration to find.

    If you want to configure a static DNS on your router, and then connect to the Setup page of your router and on the tab of configuration below, you will find static DNS1 and DNS2 DNS3. For example, you can configure a static dns on your router.

  • How do you remove all THE Java code of Vista before a Java reinstall.

    I have (Microsoft Security Essentials) has recently detected viruses in my tree of Java.  While I think that the problem was managed by MSE, I still want to remove completely all my machine Java code prior to a relocation of a pure set of Java.  It seems that Java would not provide you with a removal of Java (like MaAfee) do this, and the only code available tool is the standard Microsoft required uninstall code.  I want to remove all traces of Java code, and I don't usually use (do not trust) of 3rd party code that you find on the Internet, but if anyone has good experience with one of them, I would like to know.

    Even if the uninstaller code seemed to work, I found a lot of leftover Java files and folders left behind.  For example, there is a Sun\Java\... tree located in the AppData\LocalLow directory.  I would like to know why this code was left and whether it is safe to just delete.  I don't like just big clear code because there may be a registry entry based on the code, which could cause another problem to me (even if the Java code is supposed to be uninstalled).

    In the meantime, as an alternative, I renamed all Java directories that I can find.  Roughly the same and about as good what remove Java directories, isn't.

    And finally, I have a Vista 64-bit system, so which implementation of Java should I download/use. When I uninstalled the Java code, there is an updated version of 32-bit (Version 6, 26 update in the list of programs), as well as an outdated version of 64-bit (Version 6, Update 13 instead of Version 6, update 26) in the list programs.  These work together.   I shouldn't have to download both, I have to, or I should.

    And one last comment.  I've been running for a few days now without any Java installed on my machine and do not encounter problems or errors due to the absence of the code.  I know that many of the Applications that I use, use javascript, which I think is a little different that the standard Java code.  So what's the problem here.  Have I just not met a Java-application or is there more parts left Java in the machine I don't know or Windows excuting part of the said code.  I need to Java, I don't.

    roninrr

    Yes, Java is bad enough to remove all its files when uninstall you it but things left to do no harm. You can remove them if you want.

    There is no relationship between Java and Javascript, with the exception of confusion as well as the fact that both languages look a bit.

    You can probably do without Java. Java has become one of the biggest goals for malware recently. I uninstalled Java of my computers a while back I found I was taking more time now know to use it. I was only access a Web site regularly used and find a substitute for it. I could leave uninstalled, and see if you hit what he really needs.

    If you decide to reinstall, the 32-bit version is all you need unless you use Internet Explorer 64-bit (which you shouldn't).

  • DirectX June 2010 asking where to put the extracted files. Where should I put them?

    DirectX June 2010 asking where to put the extracted files. Where should I put them?

    Create a new folder and extract the files to the new folder.

    Let us know if that helps.

  • Where to put the password, the application running in FB4?

    Im trying to follow this tutorial: debug your application Adobe Flash Builder 4.0

    and get an error:

    Deployment failed: 1
    Error: Authentication failed because of an invalid password.

    OK, but where to put the password if testing my application in FB 4.0.1?

    There is no info about it in the tutorial and no password field in the FB4 debug configuration

    In the second screenshot, below "debug host ip", you should be able to enter your password

  • Where to put the report server ip and port for the Siebel server?

    Hello

    Where to put the report server ip and port for the Siebel server? I have checked the document "Reports Siebel Guide" but does not know where is the configuration section ' ip address of the server and port ' for 'Oracle BI Publisher.

    Note: I have installed BI Publisher, now necessary to define the ip editor and siebel server port.

    Please help, thanks.

    Hello

    Communication between Siebel and BEEP coming through webservices. You must set the Siebel Outboundwebservice 'PublicReportService' address to address BI Publisher.

    Similarly, the address of the webservice Siebel Inbound 'BIPSiebelSecurityWS' will be used by BEEP setting under the security model of Siebel - Siebel end Webservice poin of connecting to Siebel EAI, data inorder of success authenticate the Siebel user to perform the tasks of report being initiate Siebel UI.

    Please go through the integration document attached to the thread "Re: ADVISE WEBCAST: BI Publisher 11g Configuration with Siebel", it is any integration Siebel with BEEP 11g steps. " But if you go through each step, there are details about why we do it. Through this way you can better understand the integration.

    I hope this helps.

    Thank you
    Maria

  • I bought the products that goes for a year and I put the redemption code, but when I install programs, it says always that I only have a month's trial. That's happened?

    I bought the products that goes for a year and I put the redemption code, but when I install programs, it says always that I only have a month's trial. That's happened?

    Hello

    Please see redemption code help

    If you get the prompt in the first instance, please see the following help documents:

    Applications creative Cloud back in test mode after an update until 2015 for CC

    Solutions to connection errors, activation and connection with creative Cloud applications and Creative Suite

    Kind regards

    Sheena

Maybe you are looking for