Separating business logic from presentation

Hi,
I'm not sure if this is even the right forum for my question..but here it goes:
I have a device that is throwing out data into some kind of a storage device/server. Now, I have an application that reads the data from that storage and charts it. Let's say the frequency is 10 points a second.
Some of my questions below may seem strange, because i don't really understand the concepts and technologies involved.
1. What kind of storage device/server could i be looking at. What kind of server...J2EE App Server, web server?
2. How can my application be automatically notified when the server gets new data? How will that new data be passed on to my client app?
3. Let's say I have 10 different instances of the same application running on 10 different machines. Since I wouldn't want each instance to request for new data from the server, i would like the server to broadcast any new data to all the client apps that are attached to it. How can this be done?
4. Let's say I need to process the data in some form before it gets displayed on the charts. How can this processing be done on the server side itself before being presented to the client app? Basically, how can the logic be separated from the presentation?
5. If the chart is really a Swing component, but needs to be displayed in a Win32 environment (perhaps MFC dialog box or frame), how can that be done? Does this scenario change how I would address the above questions?
I really don't even know what technologies to look into to answer the above questions. Any pointers will be appreciated. I just want to start learning about how the above can be accomplished.
Thanks.

Here goes the answers to your question. (according to my knowledge)
1. Deciding a server is depends on your design of the application. According to point 3, you are better to use JMS with publish and subscribe model. In this case you have to choose a JMS server that supports your needs
2. Again it is depends on your Design, one way is to put a shared memory for data and write a thread that reads from the shared memory or use java.net package or use JMS etc.
3. Create one JMS source and all other will be JMS destinations.
4. You can use EJBs or Java classes based on your requirements and design to process the data.
5. Using AWT or Swing as a presentatin layer is good. But you desperately want to display it using Win 32 objects, then why dont to go for Microsoft technologies??

Similar Messages

  • Separating business Tier from presentation tier your opinion welcom

    Hi'
    I'va a business object which data members are stored in DB. The question
    is while I'm creating new object should I return exception to the
    presentation tier if object doesn't exist in DB(it's data members) or
    should I initialize object with empty values and afterwards call a
    function which will initialize object with values and test result of this
    function?

    It is okay to include basic logic like:
    Object a;
    try {
    a = getExistingObject(key);
    catch (Exception e) {
    a = createNewObject(key);
    finally {
    a.initilise();
    }just make sure no real business logic seeps into your presentation layer.

  • Seperate business logic from application logic

    Hi guys,
    I am looking for a good article explaining the princiaples of seperating between Business Logic & Integartion logic.
    The articale will be used to exlplain the prinicples SAP PI is based on when it comes to integration between 3rd party systems (Non -SAP) missign the application layer and buisness logic.
    If any one has a link to an article as such.
    Will be most appriciated.
    Regards.
    Nimrod Gisis

    It seems that the general rule to making a GUI
    application is to seperate the "Business Logic" from
    the "Presentation Logic". This is absolutely true.
    From this, I'm guessing I'll
    need to package all my GUI stuff together, and all the
    business logic layer stuff together.If you mean the package names and structure then I would had adapted this structure:
    1. I will have a package under which I will put the application common classes and interfaces.
    com.myapp.common.eventhandler.EventHandler (interface)
    com.myapp.common.eventhandler.AbstractEventHandler (default implementation)
    com.myapp.common.form.Form (interface)
    com.myapp.common.form.AbstractForm (default implementation)2. Create for each subject area its own package:
    com.myapp.product.AddNewProductForm
    com.myapp.product.AddNewProdcutEventHandler
    com.myapp.sales.PriceListEeventHandler
    com.myapp.sales.PriceListEeventHandler
    The GUI will then talk to the Biz lay through an
    interface right?As I illustrated through my previous example, you should have common interfaces and you might need to create Abstract classes that encapsulates the common implementation for these interfaces, then for each GUI Form or Web Page you will create its specific implementation class which inherits from the abstract class.
    Finally if you were asking about the deployment packaging:
    1. Create for each EJB its own jar file then bundle these Jar files under one module jar file, which represents the EJB module.
    2.Package the web application (JSP, Servlets, HTML, Images, CSS, and Java script) in one Web module WAR file.
    3. Package your client application module in its own jar file.
    4. Assemble the EJB module Jar, Web module War, and Client module Jar in one J2EE package which will be an EAR file so that your whole package will be assembled in one EAR file at the end.
    Try the "Application Assembly Tool" which comes with WebSphere. It will organize your application and facilitate this kind of integration.
    - Sherif.

  • How to design application to decouble business logic from GUIs on SAP N7.0

    Hi guys,
    How should I go about designing a program, so that I can decouple the business logic from GUI in ABAP in such a way that I can change the GUI easily or use different GUIs eg. on a scanner etc..

    You may use BDT (business data toolset). It's rather complex. Or use web dynpro but also complex. Or you can program it by yourself (much less difficult).

  • Separating application logic from GUI

    I don't know if this is the right forum to ask this question. I know that It's a very bad practice to embed application logic in GUI code, they have to be separated and communicate in some way. I've read somewhere that they need a kind of an adapter class or a knowledge of design patterns, which I actually don't have.
    Could someone direct me to a nice tutorial, which explains this issue? Thank you.

    hey KidJava, here is something about separating application logic from GUI ...
    http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step.html

  • Segregating business Logic from JSP files.

    I have an application with around 150 jsp files, out of which almost half of them are containing business logic.
    I am actually in a process of segregating the java code from the jsp files.
    Could you please guide me in finding out the best practices, dos and don'ts while engaging in such a process.
    Thanks in Advance

    I've been through this hellish experience. I’m not sure any “best practices” for this exist.
    gimbal2 idea of starting a new project would be ideal, if costly. The other extreme is “it works”, don’t touch ‘em until you need to change the functionality then work out the cost/befit of a rewrite for that slice.
    If you really want to take this route:
    How bad is the code that does not live in the JSPs? Should it be reused or avoided?
    What level of functional test coverage do you have?
    The approach my team and I took was to cut it down into slices and try to rewrite that slice as cleanly as possible. Where interactions between slices exist try to write a facade which calls the legacy code but looks like how you would want the new code to look.
    This did not work perfectly. The facades were rarely used well and we had to drop major slices of work to complete on time leaving us with large chunks of legacy code that we can’t delete.
    We started with no automated functional tests, but a goal of getting to a decent amount. We failed on this, which caused major issues - mop up lasted a month and a half after release. Drop functional slices to ensure that you end up with a solid set of automated tests. If you can not get your team to buy into this don't bother with the project.

  • Do you want to completely separate application logic from presentation logi

    There is solution!
    http://javaby.sf.net
    JavaBY Template Engine is a general template engine used for generating any type of text document from a template. JavaBY Template Engine is used mostly for generating HTML from servlets but it can also be used for generating XML, RTF, WML, e-mail text, source code and configuration files.
    Template has existed in different forms for several years, its concepts are proven, its implementation is robust and it performs well. Using JavaBY Template Engine instead of JavaServer Pages means that you can completely separate your content from your markup, as the originators of markup languages intended.
    The difference between JavaBY Template Engine and JSP is that content can be generated outside a webserver and that the layout is completely separated from the application code. JavaBY Template Engine defines a well-formed tag language (by default it is embedded in HTML comments). There is no scripting language involved. No calls are made from the template to the application and no calls are made from the application code to the template. The result of this is that an application becomes easier to maintain and you get a higher degree of reuse since the same template can be used with different application code and the same application code can be used with different templates.
    JBYTE vs. WebMacro, Velocity, Freemarker.
    JBYTE is genuine template engine, which not contain a macro language definitions.
    However, Velosity, WebMacro, Freemarker is not template engines. It's macro languages embedded in HTML.
    So, if you want to use genuine template engine, your choice JBYTE.
    When you use JBYTE, you not need to know another macro language or programming language.
    You use Java for Model and Controller layer of MVC architecture and use pure HTML for View.

    Do a clean (re)install and delete the Firefox program folder (C:\Program Files\Mozilla Firefox\).
    Download a fresh Firefox copy and save the file to the desktop.
    *Firefox 9.0.x: http://www.mozilla.org/en-US/firefox/all.html
    Uninstall your current Firefox version, if possible.
    *Do NOT remove personal data when you uninstall the current version or you lose your bookmarks and other data in the profile folder.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    *It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    *http://kb.mozillazine.org/Uninstalling_Firefox
    Your bookmarks and other profile data are stored elsewhere in the Firefox Profile Folder and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Profile_backup
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • Separating content from presentation

    Hello all, I'm currently evaluating WCMS options (including Adobe CQ) for a large client who needs a WCMS for managing products and marketing campaigns.
    At first glance, CQ appears to be a WCMS on steroids. The technology stack is well considered and scalable, which provides a good building block for web content management. Furthermore, I'm impressed with its campaign management capabilities. All very promising.
    However, my concern on it's suitability lies with it's content architecture. Here's the issue I'm looking solve: my client offers many different products (hardware and software) and services. For each of these products and services, they publish marketing collateral to:
    The Internet (their website)
    Their Intranet
    A product brochure (pdf)
    A range brochure (pdf of related products)
    Sell sheet (2 page pdf with product overview and features)
    Their problem (and I'm sure one shared by many others) is that if a product changes, for example a new feature is added, the content has to be updated in five separate places.
    What I'm looking for is a single-source publishing solution where content is authored and controlled (for example workflow review and approval) in a central repository, then versioned and published to different formats (for example, a sell sheet would not include all detailed technical specifications).
    I was hoping CQ would step up to this challenge of offering a CMS that where I can publish product content to the website and Intranet, while also creating versioned content (through API integration with InDesign Server). After all, Adobe provide cross-media publishing solutions...
    However, CQ appears to break away from the classic MVC model and more specifically, it doesn't follow a typical CMS design by providing a clean separation of content from presentation. If the same content needs to be presented in different versions or formats, it appears that the only real way to achieve this is by duplicating the same content across different CQ components.
    Am I missing something here?

    Hi EliotHarper, thanks for your very well posted question.
    Yes, separation between content and presentation is at the core of the WCM concepts, and CQ5 aims to solve this requirement in a clean way.
    Generally speaking content is stored in the repository in the general form of nodes and properties and information related to its presentation is loosely coupled (and can reside somwhere else). The fact that the standard content hierarchy fits into the actual pages hierarchy is just the simples option to ensure authors an incontext experience in a natiral way. But depending on your project, youcan override this approach.
    Based on your specific project requiremenets, you may choose from a set of different approaches. I'm mentioning 3 of them in more detail here.
    1. Create different renderers for the same resource, to be used depending on where the resource is consumed.
    for example /content/products/myproduct.html would render differently than /content/products/myproduct.detail.html
    http://sling.apache.org/site/url-decomposition.html
    2. Use references. The same resource can be reused (as a reference) in other places. Updates to the content are reflected everywhere, since others are only references to the same resource.
    http://dev.day.com/docs/en/cq/current/wcm/default_components.html#Reference
    3. Multisite management features. A piece of content (also at a deeper level than a page) can be rolled out to an arbitrary nuymber of 'live copies' at one time. Live copies provide a separate copy of the same content but with a link to the original content, to better manage updates.
    http://dev.day.com/docs/en/cq/current/administering/multi_site_manager.html
    Please let me know if this helps. Regards.

  • Business Logic with EJB

    Hi all!
    I googled EJB:
    Enterprise Java Beans. A standard distributed component model. The encapsulation of business logic into business objects is the most recent focus of the information Technology industry. Objectified business logic. Server components that adddress critical business functions.
    I also found this:
    Isolate business logic from connectivity issues, especially
    connections with databases including transaction management
    and security.
    Meaning? What is business logic? Practically I mean...

    Just don't throw your business logic (what should the program do from a user standpoint) in the same object as the technical logic (what is the programm doing in addition to implement the business logic, like storing data, loading data, converting data, etc.).

  • Business logic in PL/SQL?

    Hello,
    I am designing a 3-tier, web-based intranet application for my client. It's going to be a WebSphere portal app with Struts, running on Oracle 8.1.7.
    One of the requirements is to implement the business logic in the back-end (PL/SQL), not in Java (although that is what I'm used to do). The reason probably has something to do with fear of performance issues ("the more code runs in Oracle, the faster") and resource planning ("more people here know Oracle better than Java").
    This unusual (?) choice in my humble opinion leaves me with two major issues; how to cache database results and how to perform the O/R mapping.
    I know how to use CallableStatements and JDBC, but I'd really like to avoid such a solution now we have EJB 2.1 and Hibernate and everything. And without caching as done by any sensible app server I fear performance issues.
    Does anyone know a tool that can perhaps generate Java code and performs the O/R mapping? Or a tool that avoids me having to implement up to a hundred (!) CallableStatements and ResultSet-To-JavaBean mappings. I've seen Apache's commons-dbutils that seems to do this.
    Does anyone have experience implementing business logic in PL/SQL and calling procedures from Java? Is performance really an issue here?
    Thanks in advance for any input,
    regards,
    Bram Rooijmans

    This unusual (?) choice in my humble opinion leaves me
    with two major issues; In non-trivial applications excluding all business logic from the database is usually an architecture or design bug. Businesses do use the database directly due to legacy, tools, comfort level, etc. And in those cases the data still needs to be consistent. Not to mention that for some business logic the database can be orders of magnitude faster in running it versus external logic.
    On the other hand I would consider it a bug as well if someone told me that all the business logic must be in the database and no where else. (At the very least I would suspect and question their definition of business logic in that case.)
    I know how to use CallableStatements and JDBC, but I'd really like to avoid such a solution now...How are you going to implement any non-trivial business logic in oracle without using stored procs?
    Does anyone have experience implementing business logic in PL/SQL and
    calling procedures from Java? Not sure of the question. Certainly I have implemented business logic in PL/SQL. And many people have used stored procs via java.
    Is performance really an issue here?No idea. That is a dependency of your system, not of java/databases in general.
    I have seen java only solutions that even with scalling take hours to do operations that could be done in much less time using the database itself.
    I have seen requirements which would have taken hours even in the database and changing the requirements meant it took less than 2 minutes. (It had nothing to do with java nor the database.)
    I have seen code implementations which took significant database processing time where the entire solution could have been done without the database at all.
    I have seen solutions where, due to business requirements, the same business logic was implemented in different languages and in slightly different ways in each. Implementing the logic in stored procs meant that all of the systems that used it now would be using the same rules. In that case it is possible that the solution was actually slower. But if it was it was not noticed and the consistency was much more important.

  • Where do I write business Logic?

    Hi,
    Where do I write bisiness Logic?
    Tutorial said "It is common practice to include the bean property and the Action
    implementation to which it refers within the same bean class".
    But I thought EventHander Impl is better to write business Logic
    like retrieving the data from database.
    Which is common use?
    Or I need to choose them depending on the situation?
    Thanks in advance for you help.
    tomo

    Thanks for the reply!!
    But I am still confused.
    I thought I can write business logic A and B.
    What is difference between A and B ??
    Hi tomo,
    In the two options you provide the difference is not that much. The ActionListener instance willhave to be registered in your JSP of course to listen to the button or hyperlink with the f:action_listner tag. But in both cases your biz logic is in your ui. I think that is the wrong direction for you to head.
    I think the real question should be (forgive me if I'm pulling the discussion away from your question, but I think this is relevant) where does the business logic go.
    As Kito said your biz logic belongs apart from your UI logic (classic MVC approach). So in the real world what does that mean? As you suggest in option B in your last post a bean provides an action so that it can be specified via the actionRef attribute. This action in turn invokes a method on the bean it comes from which then invokes the business logic on the 'real' business logic.
    The Action becomes simply a translator (or part of the Adaptor pattern from the GoF book).
    For example lets say you have a bean that does biz processing like this;
    public interface CatalogFacade {
      public Collection getProducts(ProductSearchCriteria criteria);
    }And you want to invoke that 'business logic' from your JSF UI. The button would be declared with this code
    <h:comman_button id="searchCommand" type="submit"
                        label="Search"
                        commandName="search"
                        actionRef="searchBean.searchAction"/>In your searchBean you have many options to return the searchAction but I prefer the following
    public class SearchBean {
       public SearchFacade searchFacade = null; // this could be a managed bean or an EJBSession or whatnot
       public ProductSearchCriteria productSearchCriteria = null; // this should be 'filled' in by the form the button is on
       private transient Action searchAction = new Action() {
        public String invoke() {
          return search();
      public Action getSearchAction() {
        return searchAction;
      public void search() {
        Collection products = searchFacade.search(productSearchCriteria);
        // place the products collection into the next page's bean so that is can be found via valueRef attributes
    }Notice that no database hits are happening in the UI code. Also there is no business logic here either.
    It is very important to keep these two concerns divided for ease of maintenance. The typical reasoning goes something like this, 'your ui is very likely to change so keep it separate from your business logic'. Other reasons to be careful about mixing UI and biz logic is the likely hood that you will get very different behavior (one probably wrong) if you have to and another client to your biz logic.
    For example in the earlier product search stuff. If we needed a web service front end to the 'searchProducts' functionality and we had the db hit happening in the action or page bean we would be stuck. With the above impl we get to just put a WS over the facade and we are done.
    Hope this helps.
    You can also look at some of the blueprint patterns for more info. They start here;
    http://java.sun.com/blueprints/patterns/index.html
    While some of the EJB specific patterns might be more involved than you need they provide excelent archtectural guidence for web only apps as well.
    Good luck,
    -bd-

  • Separating presentation from business logic.

    I recently wrote an article on how to separate JSP presentation from the business logic without a complicated framework.
    http://labs.revision10.com/?p=16
    I haven't seen this exact approach taken before, but believe it works fairly well for most simple web applications. Applications which tend to attract many developers to PHP do to its simple architecture.
    What are your thoughts on this approach?
    Thanks!

    Here goes the answers to your question. (according to my knowledge)
    1. Deciding a server is depends on your design of the application. According to point 3, you are better to use JMS with publish and subscribe model. In this case you have to choose a JMS server that supports your needs
    2. Again it is depends on your Design, one way is to put a shared memory for data and write a thread that reads from the shared memory or use java.net package or use JMS etc.
    3. Create one JMS source and all other will be JMS destinations.
    4. You can use EJBs or Java classes based on your requirements and design to process the data.
    5. Using AWT or Swing as a presentatin layer is good. But you desperately want to display it using Win 32 objects, then why dont to go for Microsoft technologies??

  • Urgent: how to really seperate business logic class from data access class

    Hello,
    I've this problem here on my hand and i really need help urgently. so please allow me to thank anyone who replies to this thread =)
    Before i go any futhur, let me present a scenario. this will help make my question clearer.
    "A user choose to view his account information"
    here, i've attempted to do the following. i've tried to seperate my application into 3 layers, the GUI layer, the business logic layer, and the data access layer.
    classically, the GUI layer only knows which object it should invoke, for example in the case above, the GUI would instantiate an Account object and prob the displayAcctInfo method of the Account object.
    here is how my Account class looks like:
    public class Account
    private acctNo;
    private userid;
    private password;
    private Customer acctOwner;
    the way this class is being modelled is that there is a handle to a customer object.
    that being the case, when i want to retrieve back account information, how do i go about retrieveing the information on the customer? should my data access class have knowledge on how the customer is being programmed? ie setName, getName, setAge, getAge all these methods etc? if not, how do i restore the state of the Customer object nested inside?
    is there a better way to archieve the solution to my problem above? i would appriciate it for any help rendered =)
    Yours sincerely,
    Javier

    public class AccountThat looks like a business layer object to me.
    In a large application the GUI probably shouldn't ever touch business objects. It makes requests to the business layer for specific information. For example you might have a class called CustomerAccountSummary - the data for that might come entirely from the Account object or it might come from Account and Customer.
    When the GUI requests information it receives it as a 'primitive' - which is a class that has no behaviour (methods), just data. This keeps the interface between the GUI and business layer simple and makes it easier to maintain.
    When using a primitive there are four operations: query, create, update and delete.
    For a query the gui sets only the attributes in the primitive that will be specifically queried for (or a specialized primitive can be created for this.) The result of a query is either a single primitive or a collection of primitives. Each primitive will have all the attributes defined.
    For a create all of the attributes are set. The gui calls a method and passes the primtive.
    For an update, usually all fields are defined although this can vary. The gui calls a method and passes the primitive.
    For a delete, only the 'key' fields are set (more can be but they are not used.) The gui calls a method and passes the primitive.
    Also keep in mind that a clean seperation is always an idealization. For example verify that duplicate records are not created is a business logic requirement (the database doesn't care.) However, it is much easier and more efficient to handle that rule in the database rather than in the business layer.

  • Does Jheadstart retain Business logic after migrate from form9i

    Hi
    I wish to do convertion from oracle form9i into Jheadstart
    MVC framework, I knew from doc, business logic can be emmbebed inside the Bc4j entities manually, but how far does jHradstart able to retain the original business logic inside those 9iforms if i would like to do convertion thru reading designer repository which i build from a reverse engineer process.
    please advice
    Keatmin

    Dear Ramana,
    The functionality you are looking for is called Design Capture (Forms definitions into the Designer Repository). This functionality can be found in the Oracle Designer tool Design Editor.
    Design Capture reads the Form definitions (fmb files) and creates Module Definitions in Oracle Designer. The module definitions contain Module Components, Items and the links to tables and columns. PL/SQL code in the Form is design captured as Application Logic into Designer.
    The JHeadstart Designer Generator will read the Module, Module Component, List of Values and Item definitions from Designer to migrate to a JHeadstart Application in JDeveloper.
    You do not access Forms directly from JDeveloper.
    best regards,
    Lucas Jellema

  • Seprating Persistence logic from business logic

    Hi all !!
    I was thinking about that is there any known way or a possible way by which i can write a Entity Bean in which i can seprate the business logic and Persistence logic. Like what if i want to decide at the deployment type whether my Bean is gonna be BMP or CMP.Becuzz it may be possible that CMP may work fine with a particular container but does'nt work with some other vendor's container , so at the deployemnt time i can juzz switch it to BMP rather than CMP.
    Any comments?
    Thankzz

    Greetings,
    Hi all !!
    I was thinking about that is there any known way or a
    possible way by which i can write a Entity Bean in
    which i can seprate the business logic and Persistence
    logic. Like what if i want to decide at the deploymentYep! It's called a DAO (Data Access Object). Of course, this is only useful for BMP beans...
    type whether my Bean is gonna be BMP or CMP.Becuzz it
    may be possible that CMP may work fine with a
    particular container but does'nt work with some other
    vendor's container , so at the deployemnt time i can
    juzz switch it to BMP rather than CMP.
    Any comments?Absolutely. First implement your bean class for CMP, then extend from it to make a BMP version. Then during assembly/deployment select the version appropriate to the environment. You can increase your application's portability even further by encapsulating the persistence logic in a DAO which could then be accessed from a JavaBean in JSPs/servlets (or applications) directly. :)
    ThankzzRegards,
    Tony "Vee Schade" Cook

Maybe you are looking for

  • How can we prepare the PDC Cheques from SAP?

    Hi, How can we prepare the PDC Cheques from SAP? tx Bharat

  • Replacing multiple odd pages in Acrobat X

    I have a document that needs a number of pages replacing, the problem being is that the pages in the document are not in sequence. The pages that I need to replace are all the odd ones 1,3,5,7,9,11,13..... e.t.c  If the pages were in sequence then th

  • Recording sound without Flash Media Server?

    Hello, I am totally new to Flash Media Server I need to be able to record sound via a Flash app and save it to a server preferably without the use of a Flash Media Server type setup. There is no requirement for live streaming. Is it possible to recor

  • Building Shared Object for LabView

    All; I'm trying to build a C++-based shared object to be called from LabView and use SunCC instead of gcc. The compile stage looks like:danny@traveler:~/tubes/dielectric/rod_software/lookup> make -f Makefile.unix suncc=1 sunCC -I/usr/local/lv71/cinto

  • Positioning a Video Class - wrongly offset

    I have compiled a SWF with Flex 3 from Actionscript3 that calls a Video class ("video") and plays a FLV movie. My routine sets video.x and video.y values to 0 and 0 (top left). Everything looks fine when I play it in the Flash Player... however.; Whe