Construction of class: method vs function?

In any general programming forum could answer that question, but I thought I'd get the best answer here:

I am a class coding and have to create a function; It is only used in the constructor. It would be better to create a protected/private method, or just write a function within the constructor?

I'm not sure it's important, but I'm really curious. It struck me when I read through a program that I wrote not very long ago it seemed he randomly - unless, of course, more than one method in the class use the function, or it must be accessible to the outside (public method).

Hmm, good point about nested functions. So far, what's my thought process:

Is the code should be accessible outside the class?

Yes: create a method; No: it is used more than once?

Yes: create a method; No: it is a recursive function?

Yes: create a method; No: you don't need a method/function.

Wait, doesn't this way works is dead and turned into zombie-methods that want to eat my brain? O_O

Also, here's my process of thought to the variables and properties:

Is the value should be accessible outside the class?

Yes: 1; No: 2.

(1) Yes: it is readable and writable, and requires no validation? Yes: create a property; No: create get/set methods.

(2) no: it is used by more than one method?

Yes: create a property; No: create a variable.

These process maps are completed, do you think?

Tags: Adobe Animate

Similar Questions

  • How to change a Base class methods

    Hello

    I extend a CO and the base co uses a method processReturnButton() in which he uses the executeServerCommand and then proceed to a treatment and passes the URL to another page.

    I want the same functionality to happen except the redirect URL to a different page. How can I achieve this.

    Thank you
    HC

    CCG

    will the base class call points to the base class method instead of the overriden method I guess.
    

    If you call processReturnButton method of parent CO then always the Parent processReturnButton will not be called the overloaded method.

    I hope I am clear.

    Kind regards
    GYAN

  • Open the Script - how apart from methods or functions in other Scripts chained

    Hello

    There is a concept of pipe several scripts into open script. I am able to share variables to chained scripts. I'm not able to do, is to share a method or function to chained scripts. Is there a way to share a user defined function or method to the chained script.

    For example: that's what I want to do

    (1) script 1: create a method - 'Method1' container ' {System.out.Println ("method 1 called") ;}}. (Or create a method in a separate class file or executable)
    (2) script 2: (it is chained to Script 1) now I want to call the created method 'Method1' in this script.

    I know that in java we need to create a class that contains this method, and then pack it and then import it into our project. Is there a way to do this can we create our package and then add this to OATS if possible can someone let me know how this can be achieved.

    Thank you

    Hello

    You don't need to import the pot only create/import files that the file of the example class requires the Jar file to connect to an Oracle database.

    There are some efforts to have a shared class file, however based on OpenScript using the standard Java rules it makes this task a bit complex, the old tool was OFTEN also the very notion of having a shared methods (used as QTP VBA) file, I'm sure that this tool will be executed in the near future , but now he must wait.

    Concerning

    Alex

  • Can not reach the class methods

    Hi, I am a newbee to Flex and one I have this problem:

    I have the application MXML and actionscript class file User.as. Problem is that I can't reach the application MXML class method. I'm using Flex 3.0 beta 1 release.

    User.As: (stored in users/Users.as)

    users of package
    {
    public class User
    {
    private var connection: String;
    private var pass: String;
    private var email: String;
    private var firstname:String;
    private var lastname:String;

    public void User() {}
    This.Login = "";
    This.Pass = "";
    This.email = "";
    This.FirstName = "";
    This.LastName = "";
    }

    public void setLogin(log:String):void {}
    This.Login = log;
    }
    }
    }

    application:

    import the users. User; Import class
    var: the user = new User(); create the new object of class user
    Person.setLogin ("somelogin"); using a class method

    I got this error: "access of undefined property person.

    I'm looking for a solution. Any help much appreciated

    Thank you

    I found the solution!

    Person.setLogin ("somelogin"); Ant, it must be in the function

    example:

    private function init (): void
    {
    Person.setLogin ("petruska");
    }

    Thanks for your replies!

  • How do I keep track of all the classes/methods/properties created in a long script


    Hello

    I'm curious to know how people use to keep track of all the classes, methods and properties that you created when you write a script any longer.

    For quick scripts, this isn't a problem. But for long scripts, it can become quite difficult to keep track of all the objects, was created, and all their methods and properties and builders overloaded, etc..

    ESTK is large, and it is the IDE that I use for InDesign scripting, if only because of, it is powerful, debugging options.

    But it provides no way to keep track of such things. No good Intellisense in Visual Studio.

    I'd be curious to hear how people solve this problem.

    JsDoc can generate documentation for the JavaScript API commented and can be used for ExtendScript.

  • Get the error: class/method: tcReconciliationOperationsBean/ignoreEventAttr

    Hello
    I get this error in my log files when I run our custom role add scheduled task:
    Class/method: tcReconciliationOperationsBean/ignoreEventAttributeData a few problems: data not found.
    But I can't understand where is the problem with the error. If the user account is not present in the IDM or data of user role in do not present in the child view data. Please help if someone faced this error before.


    Thank you
    Kalpana.

    This error means that you are trying to present an event of reconciliation which refers to a child table, but does contain no data for the child table.

    Is - what your custom scheduled task has a provision to make the test for a single user, you can check this single user, it will help you to debug.

    Thank you
    Patricia

  • How to call java class/method control-flow-case

    Hello everyone, I'm newbie...
    I have little problem managing about control-flow-case adfc-file config.Xml. in this case i'want to call control-flow-case of java class/method (manage-bean)

    If someone help me solve this problem...?

    THX cordially
    agungdmt...: D

    If you have the control-flow-case defined between Page1.jspx to Page2.jspx as "goToPage2."
    You can use the code snippet in the bean managed in Page1.jspx

    FacesContext context = FacesContext.getCurrentInstance ();
    context.getApplication () .getNavigationHandler () .handleNavigation (context,
    NULL,
    "goToPage2");

    Thank you
    Nini

  • Dynamic release of variable size of dispatch class method array on FPGA

    I have a parent on the FPGA class that will serve as a model/framework for future code which is developed. I had planned on creating a class of the child and by substituting a few methods. The child class constant would have fallen on the schema so that the compiler would have no trouble knowing which method (parent or child) should be used (i.e. the parent method will in fact never used and will not be compiled with the main code). The output of one of the methods is a table. This table will have a different size depending on the application. I set the size of array as a variable. In the method of the child, there is no doubt about the size of the array so that the compiler must be able to understand. However, when I try to compile, I get an error on the size of the array. I can't figure a way around it. Any thoughts would be greatly appreciated!

    Thanks, Patrick

    The question implies the use of the register shift unitialized. On the first iteration of the loop, the value that comes out of the shift register is the default value for the data type, which is an empty array for a table (size zero). Therefore, unless wire you a table empty for the shift register to the right, the size of the array cannot infer statically by the compiler.

    To resolve this problem, you must feed an initial value for the table. Here, I just used the function of the matrix, but if you need to have a separate method that returns an array of default or the size of the array that will work as well.

  • How can I turn this into a class or a function?

    Hey all, this is my first time on this forum posting.

    I have a piece of code that is repeated several times. It is a repetitive process, this should in my view be put into a function. It sets properties of landmarks on a custom map I made. As I'm pretty much a beginner to the ACE, I can't quite understand how to turn this piece of code in a function (or class?). I tried several times, but I cannot fix things.

    The instance name of the button in my example is 'button '. I need the name of the instance url when clicked, the title ToolTip on hover and the text of the ToolTip to the overview as parameters for my position, I guess because these are the only things that change each time.

    button.visible=false;
    button.buttonMode=true;
    button.mouseChildren=false;
    button.addEventListener(MouseEvent.CLICK,myBtnClicked);
    function myBtnClicked(e:MouseEvent):void {
     var url:String="http://myurl.com";
     var request:URLRequest=new URLRequest(url);
     try {
      navigateToURL(request,'_self');
     } catch (e:Error) {
      trace("Error occurred!");
     }
    }
    button.addEventListener( MouseEvent.MOUSE_OVER, this.onMouseOver);
    function onMouseOver( event:MouseEvent ):void {
     var contentFormat:TextFormat = new TextFormat();
     contentFormat.size=12;
     contentFormat.color=0x000000;
     contentFormat.bold=false;
     var tt:ToolTip = new ToolTip();
     tt.tipWidth=250;
     tt.hook = true;
     tt.delay=0;
     tt.titleEmbed=false;//allow embedding for title
     tt.contentFormat=contentFormat;
     tt.bgAlpha=.85;
     tt.align="left";
     tt.colors=[0xb6a674,0xc7b889];
     tt.show( button, "Tooltip Title", "Tooltip Text);
    }
    

    I want to turn it into something (function/class) I can approach like this:

    buttonSetProperties (buttonInstanceName, buttonUrl, buttonTooltipTitle, buttonTooltipText);

    It is a function/method call.  show the method itself.

    It expected to resemble:

    function show(button:MovieClip,s1:String,s2:String):void {}

    ...

    }

    except your show() method looks like probably:

    function show(button:__Sprite__,s1:String,s2:String):void {}

    ...

    }

  • DeskJet 2050: Deskjet 2050 driver class PCL3 of functioning in Windows 10 scanner is not available

    Should be PCL3 printer class driver that he wouldn't print A5. However, the scanner is no longer available. Any ideas on how to fixit?  HP fixed the real drivers of 2050? Thank you very much in anticipation.

    Hi @Neptuno,

    Here is the link for drivers and full software functionality: DJ2540_188.exe

    I have provided a document to learn how to launch and use the HP scanning software: scanning the computer with scanning HP.

    I hope this helps. Thank you!.

  • How to get a list of the methods and functions to use in the Transformation

    I am developing a transformation to apply the schema of a table in the relational model according to its type of classification. I was able to do this, but I have a doubt, in other words, how get the name of the first additional classification type, listed in the dropdown list of "Selected" of the "additional part" of the section "Types of Classification" of the table "Properties".

    This is the code that I'm working on:

    tables = model.getTableSet () .toArray ();

    for (var t = 0; t < tables.length; t ++) {}

    table = table [t];

    rating = table.getAdditionalClassificationTypes () .toArray ();

    SchemaName = ";

    {if (rating. Length = 0)}

    SchemaName = table.getClassificationType ();

    } else {}

    for (var s = 0; s < classif.length; s + +) {}

    {if (rating [s]! = table.getClassificationType ())}

    SchemaName = rating [s];

    }

    }

    }

    table.setSchema (schemaname);

    }

    The problem lies on the fact that I am able to get the ID of the Type of ranking, but not it's name...

    I was wondering if there is some document that lists the methods, functions, and namespaces that I could use in Data Modeler?

    Thanks in advance

    Wolf Goebel

    Wolf Hello,

    You can find the description of the API in the following directory:

    \datamodeler\datamodeler\xmlmetadata\doc

    Best regards

    Joop

  • Need a validation in the voRowImpl class method?

    Mr President

    I need a validation method in the view line object implementation class.

    How to do this.

    Concerning

    Simply call

    getDBTransaction () .commit ();

  • [ADF, JDev12.1.3] Java webservice class methods mapping: which are the best practices? I seek advice from experts...

    Hallo,

    in my application (let's call it "MyADFApp"), I created a Java class (let's call it 'Services') which maps simply a C++ application methods (let's call it "Différendsapp") similar to a Web service.

    "Différendsapp" works on the same machine where the "MyADFApp" (works on Glassfish).

    I need to use the 'Services' methos both in the model layer and ViewController so:

    • I imported 'Services' in the AppModuleImpl
    • I created in the AppModuleImpl method for each method of 'Services '.
    • I exposed these new methods of AppModuleImpl for the ViewController
    • I configured class 'Services' to call "Différendsapp" on localhost since it runs on the same computer in 'MyADFApp '.

    In AppModuleImpl, I can call 'Services' methods directly while controlled beans think I call these methods to help

        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();
        OperationBinding operationBinding = bindings.getOperationBinding("ServicesMethodToCall");
        operationBinding.getParamsMap().put("param1", param1value);
        operationBinding.getParamsMap().put("param1", param2value);
        operationBinding.execute();
    
    

    I am a beginner and I would like to know by experts if the instinctive approach I follewed is good or not and if JDev/ADF offers me a better way to use my class of 'Services '.

    For example, I tried to convert my class of 'Services' in a DataControl and I wonder if will work it after you have configured the class to use localhost or not.

    I wonder if after you have configured the class to use localhost will work in the case I have to import/use also the class directly in managed bean (which I did in AppModuleImpl).

    I would be happy if you could answer my questions and give me some explanation.

    Thank you

    Federico

    Refer

    https://groups.Google.com/Forum/#! subject/adf-methodology/9NPM6J64f0E

    http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/92-cache-WS-queries-523136.PDF

  • The session class method "connect."

    Hi all

    Anyone know how the argument 'version' in the Connect method of the Session class becomes the PeopleTools version when connecting? I see in the PeopleSoft documentation, it is still defined as "1". However, how he took over the version of PeopleTools of the used psjoa.jar file? Any suggestions?

    Session.Connect (version, {'EXISTING' | //PSoftApplicationServer:JoltPort}, user name, password, ExtAuth)

    Here's what I'm trying to accomplish:

    The below error raises the following when the PS tools connect with does not match what is on the application server. I like to know where to find the version number of PeopleTools on the web server, in the example below, it would be '8.51.16 '. Where is it stored? Is there a way I can call to retrieve this info?

    Error:

    Release of PeopleTools (8.51.16) for the web server "is not the same as the Application Server PeopleTools release (8.51.08). Access denied. ;

    Thank you in advance!

    Thone

    So after having read the two messages, I think that the solution of the other post corresponds to your need. Integrate you with PeopleSoft, the client gives you a copy of the psjoa.jar to deploy on your end. It is supposed to match their current version. You probably had problems where they sent you the wrong copy or you have deployed the wrong version somehow, and you want a way to validate the version against what they are running. When you refer to the version on the web server, you really mean the file psjoa.jar on deployed on your server. In which case, I gave you 2 solutions on the other thread.

    If I got that wrong let me know and if not I think we can let this thread go now.

    BTW: If you find my posts useful or answer your question, please report them accordingly. I'm trying to get out of the status of beginner and half of the people asking question never give points :)

    Thank you

    Published by: CCR on March 7, 2013 21:01

    Edition of the grammar

  • LineBitmapStyle and drawTriangles not available in the Graphics class methods

    I amwriting an application that uses the graphics class to draw a picture, but I can't access the methods lineBitmapStyle or drawTriangles. they may not appear in the menu of AutoComplete for the Graphics object that I created. On my colleague's machine, these methods appear, makes me think I have a bad file somewhere, I tried using different SDKs (3, 2-4, 0) nothing works.

    Picture 1.png

    Does anyone have any ideas why do they not appear these methods? This link has been the only clue I could find through a google search:


    http://Shigeru-Nakagaki.com/tools/LibMgr/class_methods_in_FP10_RC_but_not_in_FP9.html

    I'm really stuck on this. Any help is greatly appreciated.

    d

    Doug,

    They are only available in Flash Player 10. Flex Builder 3 is designed for Flash Player 9. Therefore specifically tell Flex Builder to target Flash Player 10. Instructions on how to do this are here: http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10

    It is explained elsewhere where on the web might be better. But this is the official Adobe service.

    Thank you

    Philippe

Maybe you are looking for

  • Can't print Photosmart C5280. Error "object GPCore COM has stopped working and was closed".

    I have problems printing my Photosmart C5280 All-in-one on my desktop of Windows Vista 32-bit. I felt for a few years and have only recently met this issue. A few months ago, I set up a home network so I could print from my Toshiba laptop. The printe

  • Found a fictitious find my Iphone site

    I lost my iphone 5s in 2014. Recently, I received an sms informing me that my iphone 5s has been found and a link to check on the site. The link provided has been www.lcloud-helps.com. The message was "Apple Inc." downstairs, supposed to be Apple. By

  • (Redirected) In Windows 7 unknown network controller

    Hello.  I just bought an Inspiron 3650 [Amin Note: Service Tag published by policy TOU] and downgraded to Win7.  I ironed all drivers, but one.  It is: PCI\VEN_168C & DEV_0036 & SUBSYS_020E1028 & REV_01PCI\VEN_168C & DEV_0036 & SUBSYS_020E1028PCI\VEN

  • New network not found wifi HP Probook 4340 s

    I have a problem with my wifi connection. I installed the new modem Asus DSL N55U to my desktop but my 4340 s HP Probook does not show the network in the list of available networks. It shows several other networks around us but don't watch that I jus

  • MOAC in CRM Module

    Hi people,How is - what implement us MOAC functionality for CRM Module. CRM tables do not have column org_id setup the MO: profile of operating unit option does not help.Can someone shed some light on how we can achieve this in forms seeed without to