Creating Model Interfaces for GUI Layer

I'm trying to avoid directly using a class from my model layer in my GUI. But I need to use a method in my class lets say, "setPropertyFoo(object)". So is it worthwhile to create an interface for my class, have my class implement the interface, and then use the interface in my view layer just for this one method? And the broader more general question is, is there a point at which one should not create interfaces? Are interfaces, though a standard of proper OOP programming, ever a symptom of an underlying poor design structure if they are needed in some way? I would hope not but I'm still learning.
// Model layer
public class MyClass implements MyInterface
     private Object foo;
     // For simplicity
     public void setPropertyFoo(Object obj)     
          foo = obj;
public interface MyInterface
     // Just this...Just this one method...
     public void setPropertyFoo(Object obj);
// View layer...
MyInterface face = Factory.createMyClass();
public void valueChanged(ListSelectionEvent event)
     <.....>
     face.setPropertyFoo(list.getSelectedValue());

Your response sounds sensible to me. Thanks.
Part of any piece of software will be about behavior.
Part will be about data. Face it, a lot of what
software does is move data around. IMHO, at boundaries
between layers or modules (e.g. the DTO/DAO/VO for
moving data between a database and your program), or
wherever conversion occurs (to/from XML for instance)
you may need some getters and setters.I agree.
I try to avoid get/set in my code, but if I find I'm
writing a whole bunch of goop just to achieve that
grail, I stop and think about whether concealing that
particular object's state really needs to be
sacrosanct. And when I do provide access to that data,
it's not just blind get/set that sets or returns any
and all fields directly.This is helpful. It makes me think that there may be alternative means of achieving the same end without directly calling "set" on a field. Interesting.
Off the top of my head, if
you're doing a lot of passing objects as parameters to
methods that just call getters and setters and act on
the results, as opposed to saying
object.doSomethingThatModelsABusinessAction().This is helpful too. I think I see what you are saying here.
Using my example in the first post, I could modify it and say...
// View layer...
MyInterface face = Factory.createMyClass();
public void valueChanged(ListSelectionEvent event)
     face.selectionResponse(list.getSelectedValue());
// Then the model class...
Public class MyClass implements MyInterface
     private Object foo;
     // For simplicity
     private void setPropertyFoo(Object obj)     
          foo = obj;
     public void selectionResponse(Object obj)
          setPropertyFoo(obj);
          // At least this gives the object more control
          // over whether or not to set the property at the
          // selection...
}But I also appreciate what you've shared about the danger of the extreme point of view. From just what I've tried, I've been able to determine that it is possible to twist up a simple application and create more design flaws by attempting to eliminate each and every set or get method. So It's reassuring that I can leave some in where it makes sense to do so.

Similar Messages

  • Do we need to create message interfaces for idocs and rfcs thatare imported

    do we need to create message interfaces for idocs and rfcs thatare imported
    from sap server
    in scenarios from sap system to file or vice versa
    i knew that we need not create message types
    do we also skip creating message interfaces

    hi,
    you create an abstract message interface for IDOC only if you want to use
    them in a BPM (integration process)
    for more about IDOCs have a look at my book:
    <a href="/people/michal.krawczyk2/blog/2006/10/11/xi-new-book-mastering-idoc-business-scenarios-with-sap-xi"><b>Mastering IDoc Business Scenarios with SAP XI</b></a>
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Creating an Interface for a class: error

    Hi there,
    I'm new to Java as you'll see from the question.
    I created a class "Bicycle" and then went on to create an interface for it "InterBicycle" only I get the following error:
    bad class file: C:\Documents and Settings\Melanie\Bicycle\src\bicycle\InterBicycle.java
    file does not contain class bicycle.InterBicycle
    I checked in the bicycle folder and the "InterBicycle.java" file is there.
    Does anyone know where I am going wrong?
    Butterfly82

    Hey, thank you for that petes.
    Silly mistake on my part, I was just reading about Inheritance and then went on to reading about Interfaces.
    Changing this I came up with another error for each of the methods implemented by Bicycle.java:
    C:\... applyBreaks(int) in bicycle.Bicycle cannot implement applyBreaks(int) in bicycle.InterBicycle; attempting to assign weaker access privileges; was public
    Here is the code I have (Taken from The java Tutorial):
    package bicycle;
    class Bicycle implements InterBicycle {
        int cadence = 0;
        int speed = 0;
        int gear = 1;
        void changeCadence(int newValue) {
            cadence = newValue;
        void changeGear(int newValue) {
            gear = newValue;
        void speedUp(int increment) {
            speed = speed + increment;
        void applyBreaks(int decrement) {
            speed = speed - decrement;
        void printStates() {
            System.out.println("Cadence: " +cadence+ " Speed: " +speed+ " Gear: " +gear);
    package bicycle;
    interface InterBicycle {
        // List of the methods that the Bicycle class holds/implements
        void changeCadence(int newValue);
        void changeGear(int newValue);
        void speedUp(int increment);
        void applyBreaks(int decrement);
    }

  • How to create WEBGUI interface for own-created program

    Hi experts!
    Could you please suggest me:
    Some of our end-users have to work with WEBGUI interface. In T-code VL02N we have our userexit SAPLZSDEXIT (Screen 0110). And in WEBGUI we don't see this tab in VL02N. I think I have to generate web-interface for this screen. But how I can make it? This screen was developed by our ABAP-ers in se51 t-code.

    Solved

  • Is there a way to create separate PDFs for each layer in Indesign?

    I have a multi-layered InDesign file, and I would like to generate a PDF for each of the layers. I was able to create a LAYERED PDF file (one PDF page with layers), which is great, but I also need a multi-page PDF...one PDF page per layer.
    Is there a way to do this? Do I need a script? Or is there a way to extract the separate layers from the layered PDF?
    Any help would be much appreciated. Thank you.

    Check this script:
    http://indesignsecrets.com/page-exporter-utility-peu-5-script-updated-for-cs3.php
    Hope that helps.
    Marijan (tomaxxi)
    http://tomaxxi.com

  • Create an interface for SRM , RFQ

    Hi ;
    I am trying to develop an interface in XI to post 'Request For Quotation' into SRM system. Can anybody help me on this.. Any kind of help is greatly appreciated. Thanks,

    Hi,
    In XI you will seeing the namespace http://sap.com/xi/EBP. In that you will have the interface RequestForQuotationResponse_CreateOrChange_In. Use this interface directly as inbound interface and it will be having the message type and data type.
    So you create outbound datatype, message type, messageinterface and do message mapping and interface mapping as your requirement.
    So your scenario will be like File - XI - Proxy etc. I dont know how you are getting your source. So Source instead of file it may change depending upon your requirement.
    Satish

  • How to create an interface for extractors from CRM to BI/BW

    Hi Experts,
                    My aim is to bring in data from CRM source to BI/BW target so for that we have found few extractors in CRM side which we need to use in BI. I would like to know how i can achieve this. I knw we can use web services for this, but i want to knw the procedure involved in doing this. I have mentioned few extractors which has to come from CRM system to BI/BW target system. Current we dont have these extractors in our BI/BW system. Also we dont have the connection to that particular CRM source. Please advice what has to be done for the above.
    Extractors
    1. 0CRM_FM_BPO
    2. 0CRM_FM_FND
    3. 0CRM_FM_FND_ATTR
    4. 0CRM_FM_FND_EXPENSE_TYPE_TEXT
    Thanks in advance
    Shiva

    Hi,
    First we need to create a RFC Connection between CRM To BW system. BASIS persons will create this connection.
    [Connection between Source Systems and BW|http://help.sap.com/saphelp_nw70/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm]
    1.After that we can need to activate data sources in RSA5 in CRM system,
    2.post processing in RSA6 in CRM.
    3.Replicate source system in  BW system.
    those data sources will come to BW.
    Do Business content activation in BW. After you can create Info packages and load data.
    Regards,
    Madhu

  • How to create portal pages for GUI data updates

    Hi,
    We have a simple (seems) requirement to develop a portal page to provide GUI for users to update oracle tables. No valdiations or any anything, just plain inserts into the table. How do i approach this from step1. ( I have the portal installed and configures and etc).
    Thanks,
    Vijay

    Thanks a lot for your help:
    I've find a temporaly solution for my problem, it consist in a pl/sql porlet whit this code on it:
    ---------------------code-----------------------
    declare
    page number;
    begin
    page :=PORTAL.wwsbr_api.add_folder(
    p_caid => 1201,
    p_name => 'PAGENAME',
    p_display_name => 'page name',
    p_type_id => PORTAL.wwsbr_api.FOLDER_TYPE_CONTAINER,
    p_type_caid => 0,
    p_isportlet => 1); PORTAL.wwpro_api_invalidation.execute_cache_invalidation; end;
    --------------end code---------------------
    and now im trying to do this from java using an OracleCallableStatement, after that i will try to insert content using this api, if anybody knows, please put a sample of code to execute pl/sql from java using OracleCallableStatement
    Regards
    Message was edited by:
    Dreamloger

  • How can we provide suggestions/feedback to MS for improvements to the object model interfaces for Transport Agents?

    Having worked on TA's for a while now we've found there are several things missing in the object model for our requirements. Consequently we have some horrible code that need to do some things directly either with MIME or TNEF - which is a crying
    shame as MS must have all the code to do the things we need anyway, it's just that the object model is deficient.
    It'd be useful if there were an Exchange category on MS Connect where we could submit our suggestions, but as far as I can see, there isn't one.
    So, where do the Exchange TA developers get to hear customer feedback?

    Hello David,
    Sorry for not getting back to you sooner. You can provide feedback on Transport agents by using this site:
    http://officespdev.uservoice.com/.
    With regards,
    Michael | Microsoft Exchange Developer Content
    The
    Exchange Development Forum Guide has useful information for using the Exchange Development Forum.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Need information on how to create Idoc Inbound Interfaces for Business Sys

    Hi,
    I'm losing it.
    Can anyone point me to some documentation or an example of how to create inbound interfaces for Business Systems in PI 7.1.
    Here's the scenario
    I'm working on a B2B integration process which sends inbound idocs to an ECC 6.0 system.
    I've created the Business System communication component  but under the Inbound Interfaces it is blank.
    I want to have MBGMCR.MGBMCR03 as an inbound interface.
    But I forget how to get it there.
    For Business components you can just add the inbound interface.
    I've already defined the Business System in the SLD pointed it to the correct Tech System, imported the idoc definitions in the Enterprise Service Builder and set up IDX1, IDX2 to ensure the metadata exists in PI.
    But for Business systems the hep says that it's got to come from the SLD.
    Outbound/Inbound Interfaces
    For each business system, the interfaces that are installed on the business system are also entered in the SLD. These interfaces are displayed in this frame. You cannot add any other interfaces.
    I know I've done this before, but I can't remember how.
    Cheers,
    John

    Hi John ,
    Please have a look at the following links which might be of help to you
    PI 7.1 IDocs interfaces act as operations
    http://www.sdn.sap.com/irj/scn/weblogs;?blog=/pub/wlg/7933
    /people/peter.gutsche/blog/2008/10/27/what146s-new-in-sap-netweaver-pi-71
    There is a section in the following link on IDOC , have a look at the links in that section
    https://wiki.sdn.sap.com/wiki/display/XI/ImportantBlogsand+Notes
    Best Regards

  • User Interfaces for Lists

    hi,
    How to create user interfaces for lists
    thanks.

    HI,
    The R/3 system automatically, generates a graphical user interface (GUI) for your lists that offers the basic functions for list processing, such as saving or printing the list. If you want to include additional functionality, such as pushbuttons, you must define your own interface status. To create a new status, the Development Workbench offers the Menu Painter. With the Menu Painter, you can create menus and application toolbars. And you can assign Function Keys to certain functions. At the beginning of the statement block of AT END-OF-SELECTION, active the status of the basic list using the statement: SET PF-STATUS ‘STATUS’.
    Cheers,
    Chandra Sekhar.

  • Advantage of creating Model folders

    Are there any advantages of creating Model folders ? Will it be helpful in the migration process ?
    I appreciate if anyone throws some light on this ?
    Thanks,
    Ram

    We too use in similar way that of Cezar with one more layer of model folder.
    We are having multiple projects in a single repository. To segregate the models for project specific we create model folders for each project and then again sub model folders for each technology. Models will be created for each logical schema.
    There is no specific usage in the code migration by having the model folders.
    -Dhamod

  • Variable Selection For User in Web Interface for BPS

    Hi All,
    I've created a manual Input sheet in BPS0 to upload target sales. User need to select the month, plant and then enter the target amount for each category. Its working fine.
    Now I need to create web interface for user to upload the data every month. Using BPS_WB I've created the interface (with help of Wizard). I'm getting the input sheet. But I'm not able to get screen where user can select the parameters?
    How to get this? It should work like web report, where user select the report variables then execute. Only difference here is user will have to enter the data for selected variable.
    Thanks in advance.
    Regards: Gaurave

    Hi....add the variables to a folder along with the layout. Then create the web interface.

  • How to create an interface if the class has a nested class

    I have the following class
    public class SampleImport{
    public SampleResult import (InputSource xml) {
    SampleResult sampleResult = new SampleResult();
              //do something
              return sampleResult;
    public static class SampleResult {
              public final String sampleName;
              public SampleResult (String s) {
                   sampleName = s;
    I would like to create an interface for this class for teh following method signature 'SampleResult import(InputSource(xml))', how would I create it ?
    Any help is appreciated,
    TIA,

    public interface Nameable {
        String getName();
    public interface Importable {
        Nameable importSource (InputSource xml);
    public class SampleImport implements Importable {
        @Override public SampleResult importSource (InputSource xml) {
            SampleResult sampleResult = new SampleResult("foo");
            //do something
            return sampleResult;
        public static class SampleResult implements Nameable {
            public final String sampleName;
            public SampleResult (String s) {
                sampleName = s;
            @Override public String getName() {
                return sampleName;
    }edit: er, you do know import is a keyword?

  • Urgent: custom interface for HRMS module

    Hi All,
    We are creating custom interface for deducting some mismatch sales amount from respective employee's salary in HRMS module.
    So what are the interface table or API I have to use for employee’s salary detection process?
    I’m very new to HRMS module….
    Can anybody provide any documents regarding this process?
    Regards,
    Abdul wahab

    Review with the functional implementation team how will be this deduction setup to identify what information you'll need to upload. You'll need to use Batch Element Entry (BEE) interface for it. As mentioned, review iRep as well as HRMS implementatio guide for more detailed information.

Maybe you are looking for

  • Display an iview in the same page.

    Hi Experts, I need to integrate webdynpro application which is a tree application when i integrate that application  if i click on that some search button it should navigate to other iview but the present application should be in the same page and th

  • XML Type Problem

    Hi all ! I have a table with a XML_TYPE field. I use JDBC with the thin driver to connect to the base, When I do a Query like Select * from my_table, my query is save in a ResultSet. When I want to do something with my ResultSet my application is ver

  • Smart Collection matching a multi-word Keyword

    I have the following multi-word keywords: "through the years" "kelly through the years" "mike through the years" I want to create a smart collection which only matches if the keyword is "through the years".  I do not want the smart collection to matc

  • Podcasts with a fee

    I first posted this on the Podcast/Radio portion of this forum, but received no replies. I have subscribed to the new Al Franken podcast which now charges a fee each month. The problem is that everytime I boot up my computer, and it checks for new po

  • Time Machine won't back-up particular folder

    I recently reformatted my Drobo and did a complete, new backup with Time Machine. I had been using this combo for awhile and never had any problems that I was aware of. After 30 hours of backing up 1.3TB of data into a 2.4TB space, it was stuck at 1.