Best practices on how to document code?

Hi,
I tried searching the web for tutorials or examples, but couldn't come up with anything. Can anyone sum up some of their best practices to document LabVIEW code? I'm talking about a fairly elaborate program, built with a state machine approach. It has several subVI's. Since it is important, that other people can understand my code, I guess documentation is fairly important, but NI hasn't got a tutorial for it yet. Maybe a suggestion ?
Thank you for your time! This forum has been a valuable companion already!
Giovanni
PS: I'm using LabVIEW 8.5 btw
Giovanni Vleminckx
Using LabVIEW 8.5 on Windows7
Solved!
Go to Solution.

Ben wrote:
F. Schubert wrote:
Document the state machine. You can use bubble-and-arrow (using any Draw program) or uml (for beginners it is easy to start with dia). Create a png from the diagram and paste it on the block diagram.
Some use a stacked sequence with frame 0 the picture and frame 1 the code.
For the wires of the state machine, it's good if you lable them on both shift registers (outside the while).
Felix
That brings up a good point, both sides or just one?
For small diagrams that easily fit on one screen, putting the lables on both sides can somethimes increase the diagram size by 30%.
When the diagrams are small, I usually only lable one side. The other plus with only putting th labels on one side is that I only ohave one set of labels to allign with the SR while two side would require twice as much shuffling.
So I often bend that rule.
Ben
Of course If you MUST use old LabVIEW verions without Wire Labels the allignment (and BD Cleanup - clean-up) can get to be a headache.  I sell "maintainability" to my customers and explain the life cycle of the systems they are purchasing.  I can usually sell the latest LabVIEW version with this argument. 
But, I do have customers stuck in 6.1 so the point is valid.  So (IMHO) SRs need a label on only one side, since they run straight, either on the terminal(prefered) or outside the loop.  Linked Tunnels need labels on both sides and tunnels that are not linked need just one label.
And Felix brought up some great points.  Any project should have a "Tree vi" with major VIs / Modules on the BD (Hint show labels).  This Makes navagation very easy when you have a few hundred subvis.  And of course, this practice REQUIRES meaningful Icons and VI names or you are just looking at clutter.
Jeff

Similar Messages

  • Best Practices Question: How to send error message to SSHR web page.

    Best Practices Question: How to send error message to SSHR web page from custom PL\SQL procedure called by SSHR workflow.
    For the Manager Self-Service application we’ve copied various workflows which were modified to meet business needs. Part of this exercise was creating custom PL\SQL Package Procedures that would gather details on the WF using them on custom notification sent by the WF.
    What I’m looking for is if/when the PL\SQL procedure errors, how does one send an failure message back and display it on the SS Page?
    Writing information into a log or table at the database level works for trouble-shooting, but we’re looking for something that will provide the end-user with an intelligent message that the workflow has failed.
    Thanks ahead of time for your responses.
    Rich

    We have implemented the same kind of requirement long back.
    We have defined our PL/SQL procedures with two OUT parameters
    1) Result Type (S:Success, E:Error)
    2) Result Message
    In the PL/SQL procedure we always use below construct when we want to raise any message
    hr_utility.set_message(APPL_NO, 'FND_MESSAGE_NAME');
    hr_utility.raise_error;
    In Exception block we write below( in successful case we just set the p_result_flag := 'S';)
    EXCEPTION
    WHEN APP_EXCEPTION.APPLICATION_EXCEPTION THEN
    p_result_flag := 'E';
    p_result_message := hr_utility.get_message;
    WHEN OTHERS THEN
    p_result_flag := 'E';
    p_result_message := hr_utility.get_message;
    fnd_message.set_name('PER','FFU10_GENERAL_ORACLE_ERROR');
    fnd_message.set_token('2',substr(sqlerrm,1,200));
    fnd_msg_pub.add;
    p_result_message := fnd_msg_pub.get_detail;
    After executing the PL/SQL in java
    We have written some thing similar to
    orclStmt.execute();
    OAExceptionUtils.checkErrors (txn);
    String resultFlag = orclStmt.getString(provide the resultflag bind no);
    if ("E".equalsIgnoreCase(resultFlag)){
    String resultMessage = orclStmt.getString(provide the resultMessage bind no);
    orclStmt.close();
    throw new OAException(resultMessage, OAException.ERROR);
    It safely shows the message to the user with all the data in the page.
    We have been using this construct for a long time for all our projects. They are all working as expected.
    Regards,
    Peddi.

  • Best practices on how to implement logging in custom application

    In the Enterprise Manager it is possible to display/browse the content of different log files generated by the application server modules.
    I have some custom web applications which currently use the log4j framework to write to log files. Is it possible to make these log files accesible for the Enterprise Manager ?
    Or what is the best practice on how to implement logging in custom applications which can be browsed in the Enterprise Manager (I do not want to use system.out)

    I thought that this could be done. An ex- colleague did this - but he didn't tell me how to solve this.
    But as it just took 10 minutes to solve this I believe it's fairly easy.
    cu
    Andreas

  • EBS Supplier best practice to update vendor site code, update or create a new one

    I have a question related to EBS Supplier vendor site code. Application lets you update the vendor site code, but what is the best practice to update the site code?....would you inactivate the exiting one and create a new one? or would you just update the existing value?

    Ok,
    My workaround was to put in my TaskFlow an action to commit. After that I put two more actions (execute) and then back to my page. This way works but I would like to know if there is any more efficient way to do this just when I am inserting.
    Regards

  • Best practice to split up documents into articles?

    Dear Adobe,
    at the today's InDesign and DPS session I was asking how the DPS folks, split up the InDesign documents to upload as different articles to the dps? Bob wanted to ask Collin, but forgot to do it!
    I will explain my situation (supposing that most producers sitting in the same boat):
    I have a monthly magazine with about 30 different articles. I receive the print file to create an iPad 1/2, iPad 3 and beginning in next month also an iPhone and Android (also IceCream Sandwich) version. The magazine is just vertical orientation.
    Now with CS6, you do a lot of promotional work for the alternate layout feature.
    But what is the recommondation or best practice at Adobe to upload this one InDesign document with viewer builder to get an iPad 1/2, iPad 3 and iPhone rendition containing the separation of the different articles? Please let me know a workaround how you do this!
    Kind regards
    Yves

    as you know, you need one indesign file for each article (that file can
    contain cover all devices down to the iphone version). the next article
    needs a new indesign file. you can drag-and-drop pages from one indesign
    file into the new layout to move pages across documents.
    if youwant to synchronize settings, try the book feature. but I never
    tested the book feature on CS6/alternative layout compatibility.
    —Johannes

  • Best practice for how to access a set of wsdl and xsd files

    I've recently beeing poking around with the Oracle ESB, which requires a bunch of wsdl and xsd files from HOME/bpel/system/xmllib. What is the best practice for including these files in a BPEL project? It seems like a bad idea to copy all these files into every project that uses the ESB, especially if there are quite a few consumers of the bus. Is there a way I can reference this directory from the project so that the files can just stay in a common place for all the projects that use them?
    Bret

    Hi,
    I created a project (JDeveloper) with local xsd-files and tried to delete and recreate them in the structure pane with references to a version on the application server. After reopening the project I deployed it successfully to the bpel server. The process is working fine, but in the structure pane there is no information about any of the xsds anymore and the payload in the variables there is an exception (problem building schema).
    How does bpel know where to look for the xsd-files and how does the mapping still work?
    This cannot be the way to do it correctly. Do I have a chance to rework an existing project or do I have to rebuild it from scratch in order to have all the references right?
    Thanks for any clue.
    Bette

  • Best Practice for Storing Sharepoint Documents

    Hi,
    Is there a best practice where to store the documents of a Sharepoint? I heard some people say it is best to store sharepoint documents directly into file system. Ohters said that it is better to store sharepoint documents into a SQL Server.

    What you are referring to is the difference between SharePoint's native storage of documents in SQL, and the option/ability to use SQL's filestream functionality for Remote BLOB Storage (also known as RBS). Typically you are much better off sticking with
    SQL storage for BLOBs, except in a very few scenarios.
    This page will help you decide if RBS is right for your scenario:
    https://technet.microsoft.com/en-us/library/ff628583.aspx?f=255&MSPPError=-2147217396
    -Corey

  • 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

  • Best practice on how to handle employees who do not have a last name?

    We are a Canadian based company with some International employees. We have recently begun to enter the International employees into the HR module. This has led to some problems for employees from India who do not have both a first name and a last name as many of our downstream systems require both names.
    I'm wondering what other companies with International employees have done in this circumstance. Can someone recommend a Best Practice?  We want to ensure that whatever we do is not offensive to anyone.
    Thanks.

    Dear,
    Indian names vary from region to region. Sometimes Names also influence by religion and caste. Different languages spoken in India in different regions. This variety makes confusing differences in names and their styles.
    Now come to the point, since you are international company, while entering the names of your international employees - i would like to suggest to consider the employees names as mentioned in their passport (If they hold valid passport). In case of non availability of passports consider their bank information or any other available information so that they didnt face any further problems like visa, banking transactions etc etc.
    1. Maddepalli Venkata Ramana Rao
    In this case Maddepalli will be his surname, Venkata Ramana can be his first name and Rao can be mentioned as Second / last name.
    2. Hardev Singh
    In this case you didnt find a surname... Singh will be considered as Surname or his ethinic recognition. In this case you can enter Hardev as First name and Singh as last name.
    Make some entry fields are optional depending on the situation. Take help of an Indian origin employees help exists in your office.
    Regards,
    Syed Hussain.

  • ES2 best practice for how much stuff should be in one application?

    I'm wondering if there is a best practice/recommended amount of the maximum amount of forms/processes/etc that you should have contained within one application in ES2?  I have an application which has about 5 processes, and has over 300 xdp forms.  When "deploying" the application it takes probably over 5 minutes or longer.  It seems to be working fine but i'm curious if this will cause any problems and if there is a recommended threshold?

    I don't think there is a limit on the number of processes & forms to be used within an application.
    However there is recommendation for not having more than 20 variable in a single process.
    Each process created within you application will become a service. So it doesn't matter having 500 processes in one application or 50 processes in 10 applications. You will endup with 500 services deployed into Java Runtime.
    Forms also doesn't bother about the count as it just stay within repository (not in Java Runtime).
    The only issue with enormous resources within an application is the response time to Deploy to application server (which you already mentioned here).
    So, if you can split your resources into manageable units, that will reduce your checkin/deploy time.
    Nith

  • Best practice regarding automatic IU documents

    Hi Team,
    In case of automatic postings at IU elimination how to configure document type in order to allow different subassignments like segments.
    This sub assignments field in case of automatic posting documents allowing at header level and at the time of posting system allowing to post documents with different sub assignemnts at document but when you go and see individual docuement, system is not displaying that document and throughing error message.
    Can any one advice.
    Thanks and regards
    Naveen.KV

    The subassignments are not changeable for automatic IU documents as the values are the same as those of the source records.
    One option is to post manual adjusting entries to change the IU elimination subassignments.
    Another option is to create a reclassification method/task to automatically change the subassignments for the IU eliminations.

  • Best practice needed: how to dynamicly change rowset for a dataTableModel

    Hello creator folk,
    I need an advice on the following problem.
    I start from the insertUpdateDelete tutorial, and I stick to the very first part - creation of the first page with a dropdown and at table.
    Now I add a second dropdown to add another control level on my table, on tripType for example - simple, it work without problem.
    My problem: my dropdowns have a "off" value - that is a value indicating that the filtering according to this value should be disabled. For example, i want to filter displayed data according to person, tripType, or both.
    As a result, we now have 3 different request, one with personId = ?, one with tripTypeId = ? and the last one with both. But the displayed table is the same.
    I already done such a page, by using the "rendered" option: my JSP contains 3 time the same page, each with a dedicated rowset, but only one is rendered at a time. But I don't like this solution, it is a hell to maintain, and I don't want to imagine if my client ask for a third dropdow!!!
    Another possibility: create a separate page for each possibility. Well, quite the same than the previous one.
    Is it possible at runtime level to change the command associated to a rowset, and then to the linked RowSetDataModel? I tried the following way:
    In the constructor of the page:
                if (isPersonAndTripType()) {
                    myRowSet.setCommand(REQUEST_PERSON_TRIPTYPE);
                    myDataTableModel.setObject(1, this.getSessionBean1().getPersonId());
                    myDataTableModel.setObject(2, this.getSessionBean1().getTripTypeId());
                } else if (isTripTypeOnly()) {
                    ewslive_lasteventIlotRowSet.setCommand(REQUEST_TRIPTYPE);
                    myDataTableModel.setObject(1, this.getSessionBean1().getTriptypeId());
                } else {
         // the default rowset, no change.
                    myDataTableModel.setObject(1,
    this.getSessionBean1().getPersontId());
                myDataTableModel.execute();And in each dropdown_processValueChange, after updating tripId or personId:
                if (isPersonAndTripType()) {
                    myRowSet.setCommand(REQUEST_PERSON_TRIPTYPE);
                    myDataTableModel.setObject(1, this.getSessionBean1().getPersonId());
                    myDataTableModel.setObject(2, this.getSessionBean1().getTripTypeId());
                } else if (isTripTypeOnly()) {
                    ewslive_lasteventIlotRowSet.setCommand(REQUEST_TRIPTYPE);
                    myDataTableModel.setObject(1, this.getSessionBean1().getTriptypeId());
                } else {
              myRowSet.setCommand(REQUEST_PERSON);
                    myDataTableModel.setObject(1,
    this.getSessionBean1().getPersontId());
                myDataTableModel.execute();First run (one person selected by default), everything is OK. But when I change a dropdown I got an exception: the page constructor is called, all ok. The dropdown_processValueChange is called, the correct request is linked to the dataTableModel, and the function return normally, then the exception occures:
    Exception Details:  javax.faces.el.EvaluationException
      javax.faces.FacesException: java.sql.SQLException: [OraDriver] Not on a valid row.
    Possible Source of Error:
       Class Name: com.sun.faces.el.ValueBindingImpl
       File Name: ValueBindingImpl.java
       Method Name: getValue
       Line Number: 206 Help needed!!!

    I've done something similar in my current app, the only difference I see being that I retrieve the value from the dropdown directly rather than going through the sessionbean as I don't need to save the selection.
    I've managed to iron out all the bugs and it works well now. Not near my development machine or I'd post the code. I do have a couple of questions:
    Why do you have the if/else setup in the constructor? If the page is being called for the first time I don't see why you need it.
    Why do you useewslive_lasteventIlotRowSet.setCommand(REQUEST_TRIPTYPE);instead ofmyRowSet.setCommand(REQUEST_TRIPTYPE);?
    I think this is causing your problem as you haven't shown where you set the datacache for myDataTableModel
    to ewslive_lasteventIlotRowSet instead of myRowSet.
    You can also set all of your dropdowns to use the same event handler, cuts down on the duplicate code :)

  • Best Practices Q - how to allocate memory to each instance

    We are moving to a system setup that will include multiple CF
    instances per machine, with the web server on an entirely separate
    machine (Distributed CF Mode). What is the current thinking on how
    much of the total RAM on a machine should be apportioned among the
    instances in CF on one machine in each JVM config?
    For example (and this is for the purposes of demonstration,
    not real world figures) if we have 1gigabyte of RAM on a machine
    with 3 instances running, do we devote two thirds of this (750
    megabytes) for all 3 instances in total, such that each instance
    gets 250 megs? Or does each instance get 750? My thinking is that
    if each had 750 there is the potential for a machine to be brought
    down?
    I came up with two thirds as I've been under the assumption
    that in a non-multi server setup this is the general rule of thumb.
    Appreciate any and all input,
    thanks

    If you allot more than the machine has physical memory, the
    OS will just put that information into swap space. If the load is
    high enough then the machine could come to a crawl.
    With only 1GB of memory, I wouldn't try to run more than one
    instance with 768MB as the high water mark. Maybe init the JVM at
    256MB.
    Knock the machine up to 4GB, then you could go with 3 512MB
    instances or 2 1GB instances.

  • Where to put java code - Best Practice

    Hello. I am working with the Jdeveloper 11.2.2. I am trying to figure out the best practice for where to put code. After reviewing http://docs.oracle.com/cd/E26098_01/web.1112/e16182.pdf it seemed like the application module was the preferred spot (although many of the examples in the pdf are in main methods). After coding a while though, I noticed that there were quite a few libraries imported, and wondered whether this would impact performance.
    I reviewed postings on the forum, especially Re: Access service method (client interface) programmatically . This link mentions accessing code from a backing bean -- and the gist of the recommendations seems to be to use the data control to drag it to the JSF, or use the bindings to access code.
    My interest lies in where to put java code in the first place; In the View Object, Entity Object, and Am object, backing bean.....other?
    I can outline several best guesses about where to put code and the pros and cons:
    1. In the application module
    Pros: Centralized location for code makes development and support more simple as there are not multiple access points. Much like a data control centralizes services, the application module can act as a conduit for different pieces of code you have in objects in your model.
    Cons: Everything in one place means the application module becomes bloated. I am not sure how memory works in java -- if the app module has tons of different libraries are they all called when even a simple query re-execute method is called? Memory hog?
    2. Write code in the objects it affects. If you are writing code that accesses a view object, write it in a view object. Then make it visible to the client.
    pros: The code is accessed via fewer conduits (for example, I would expect that if you call the application module from a JSF backing bean, then the application module calls the view object, you have three different pieces of code --
    conts: The code gets spread out, harder to locate etc.
    I would greatly appreciate your thoughts on the matter.
    Regards,
    Stuart
    Edited by: Stuart Fleming on May 20, 2012 5:25 AM
    Edited by: Stuart Fleming on May 20, 2012 5:27 AM

    First point here is when you say "where to put the java code" and you're referring to ADF BC, the point is you put "business logic java code" in the ADF Business Components. It's fine of course to have Java code in the ViewController layer that deals with the UI layer. Just don't put business logic in the UI layer, and don't put UI logic in the model layer. In your 2 examples you seem to be considering the ADF BC layer only, so I'll assume you mean business logic java code only.
    Meanwhile I'm not keen on the term best practice as people follow best practices without thinking, typically best practices come with conditions and people forget to apply them. Luckily you're not doing that here as you've thought through the pros and cons of each (nice work).
    Anyway, back on topic and off my soap box, as for where to put your code, my thoughts:
    1) If you only have 1 or 2 methods put it in the AppModuleImpl
    2) If you have hundreds of methods, or there's a chance #1 above will morph into #2, split the code up between the AppModuleImpl, ViewImpl and ViewRowImpls. Why? Because your AM will become overloaded with hundreds of methods making it unreadable. Instead put the code where it should logically go. Methods that work on a specific VO row go into the associated ViewRowImpl, methods that work across rows in a VO go into the ViewImpl, and methods that work across VOs in the associated AppModuleImpl.
    To be honest which you ever option you choose, one thing I do recommend as a best practice is be consistent and document the standard so your other programmers know.
    Btw there isn't an issue about loading lots of libraries/imports into a class, it has no runtime cost. However if your methods require lots of class variables, then yes this will have a memory cost.
    On a side note if you're interested in more ideas around how to build ADF apps correctly think about joining the "ADF EMG", a free online forum which discusses ADF architecture, best practices (cough), deployment architectures and more.
    Regards,
    CM.

  • Code of conduct or best practices?

    Hello, I'd like to know if there is any document of best practices or a code of conduct to work with NWDI made by SAP or any other expert (blogs, articles....).
    I would really appreciate your help. Thanks in advance.

    Refer to 'Best Practices and How-To-Guides for NWDI-based Development' section in
    <<NWDI Resources>> [original link is broken]
    Following blog might be interesting for you:
    <</people/guenter.schiele/blog/2005/12/21/best-practices-for-running-the-nwdi
    Regards,
    Bhagya

Maybe you are looking for

  • Some advice on Basestation setups from the Guru's please

    At home I am about to extend an Airport network. I already have an Airport Extreme BS (old ) linked to the net via DSL. All works beautifully and the other Macs in the house can connect no problem apart from a lack of coverage. I need to extend the n

  • EPSI Dashboard problem after moving from reporting services 2005 to 2012

    I have created a Dashboard with Allscripts EPSI with a Reporting Services Report.  After we changed from Micrsosoft Reporting Services 2005 to 2012, the report now gets cut in half.  I turned a ticket in to Allscripts and they said that it had nothin

  • AdHooc Query

    I have to write a single adhoc query whose output will be two different reports. One report should display pernr,perid, firstname, lastname, age, years of service, hire date,birthdate, job title. The other should display pernr, firstname, lastname,hi

  • Filed enable in selection screen

    Hi guru, My Problem is i have created one screen through se51  i have put one table control when i press display button data will come in table control only in display mode but i want if i click on edit button then filed display in change mode then h

  • Reg: Department no in Sales Order Bapi BAPI_SALESDOCU_CREATEFROMDATA1

    Hi ALL i passing Department no at item level For example...   item-DEPARTMENT_NO = 0563.   itemx-DEPARTMENT_NO = 'X'. i am passing header level ..partner level data to Bapi BAPI_SALESDOCU_CREATEFROMDATA1 After executing the bapi i am getting error...