Home AMX User Forum NetLinx Studio
Options

Programming Organization/Logical Descriptions

I was going through my programming, and it seems as though the netlinx programming organization leaves a little to be desired. I was wondering what methods are being used to logically order the programming events for easy reading, such as breaking out Button Events into sections based on each device, or organizing level events based on rooms, etc. Something like this:
//Macros Section

//Background Audio Section

//Theater devices

//Family Room devices

If I'm crazy for thinking this, let me know. It seems to me that organizing items into this type of order might make it easier to troubleshoot issues as they arise, no?

Comments

  • Options
    I find that button arrays of similar functionality works great for organizing the main code. Source selection buttons, mode buttons, volume buttons, setup buttons, display control buttons etc.
  • Options
    you can pretty much organize it in any order you like, for example, data events for all your touchpanels, then data events for each 232 device, then button events for each device, then level events for each device etc etc etc. I sometimes break out my level events into an INCLUDE (especially for complicated DSPs) so I've got less scrolling to do in the main code.

    e.g.

    (* RS232 DVD PLAYER *)
    DATA_EVENTs...

    TIMELINE_EVENTs...

    BUTTON_EVENTs...

    (* RS232 RECEIVER *)
    DATA_EVENTs...

    TIMELINE_EVENTs...

    BUTTON_EVENTs...

    (* DEVICE 3... *)


    etc etc etc

    etc etc etc

    You can also break out each individual device into an include of you want! The possibilities are, as they say, endless
  • Options
    Another neat trick someone here posted is using multiple DEFINE sections. That way your can colllapse all you code and only open up the sections you need. IE:
    +DEFINE_CONSTANT //Touchpanel Constants
    -DEFINE_CONSTANT //PTZ Constants
    PTZ_UP=$00,$00
    PTZ_DOWN=$00,$01
    +DEFINE_CONSTANT //Switcher Constants
    

    The compiler is perfectly fine with this.

    Kevin D.
  • Options
    vegastech wrote: »
    I was going through my programming, and it seems as though the netlinx programming organization leaves a little to be desired. I was wondering what methods are being used to logically order the programming events for easy reading, such as breaking out Button Events into sections based on each device, or organizing level events based on rooms, etc. Something like this:
    //Macros Section

    //Background Audio Section

    //Theater devices

    //Family Room devices

    If I'm crazy for thinking this, let me know. It seems to me that organizing items into this type of order might make it easier to troubleshoot issues as they arise, no?

    Each of those "sections" would exist as its own include file in my workspace.
  • Options
    jjamesjjames Posts: 2,908
    shr00m-dew wrote: »
    Another neat trick someone here posted is using multiple DEFINE sections. That way your can colllapse all you code and only open up the sections you need. IE:
    +DEFINE_CONSTANT //Touchpanel Constants
    -DEFINE_CONSTANT //PTZ Constants
    PTZ_UP=$00,$00
    PTZ_DOWN=$00,$01
    +DEFINE_CONSTANT //Switcher Constants
    

    The compiler is perfectly fine with this.

    Kevin D.

    This is what I do. Easy to copy over from workspace to workspace. I prefer to keep everything in one file (I rarely use includes), that way when going through code it's easier to see the flow (IMO).
  • Options
    The more programs you do, the method that works for you will eventually come to you. Everyone has different ways and styles, more often than not if your asked to suck a program out of a system (if the .src is on it) the layout will be very different than yours, and sometimes you can tell whose it is if you've been around a little (especially within your own organization)!
  • Options
    Creating modules tends to keep the code easier to sift through also. I like to run UI and _comm modules where the _comm module just deals with communications and queueing, and the UI modules do all of the trick custom stuff.

    --John
  • Options
    a_riot42a_riot42 Posts: 1,624
    vegastech wrote: »
    I was going through my programming, and it seems as though the netlinx programming organization leaves a little to be desired.

    How so? Netlinx pretty much leaves it up to you how to organize your code. If it leaves a little to be desired, that's your doing not Netlinx.
    Paul
  • Options
    mpullinmpullin Posts: 949
    a_riot42 wrote: »
    How so? Netlinx pretty much leaves it up to you how to organize your code. If it leaves a little to be desired, that's your doing not Netlinx.
    Paul

    Some of the wording is odd, but the OP is clearly referring to his own programming practices and not criticizing NS. (at least, every other poster in the thread included some form of advice so that's what I assumed was happening)
  • Options
    DHawthorneDHawthorne Posts: 4,584
    I prefer to put discrete sections of code in modules. You just have to be very careful about defining devices and not duplicating them, especially IP connections. I would really like the workspace to be more like Visual Studio rather than what we have, but hey, you got to play the hand you're dealt.
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    One thing I would REALLY like to see added is warnings for calls/functions that are not used. I would also like to see warnings about duplicate device definitions and unused devices. When you are dealing with thousands of lines of code, it is easy to forget about such things. I suppose I could always write a little java program that could do the check for me.... but right now I don't have the time to solve the problem, only enough time to whine about it :)

    Jeff
  • Options
    PhreaKPhreaK Posts: 966
    No-one feels like writing an eclipse plugin by any chance? :)
  • Options
    jjamesjjames Posts: 2,908
    Spire_Jeff wrote: »
    One thing I would REALLY like to see added is warnings for calls/functions that are not used. I would also like to see warnings about duplicate device definitions and unused devices. When you are dealing with thousands of lines of code, it is easy to forget about such things. I suppose I could always write a little java program that could do the check for me.... but right now I don't have the time to solve the problem, only enough time to whine about it :)

    Jeff

    And how about variables & constants that aren't used? Doesn't the Axcess compiler warn of those?
  • Options
    travtrav Posts: 188
    Roll on NS4
    PhreaK wrote: »
    No-one feels like writing an eclipse plugin by any chance? :)

    Oh god please........
  • Options
    ColzieColzie Posts: 470
    Spire_Jeff wrote: »
    right now I don't have the time to solve the problem, only enough time to whine about it :)

    Awesome. :)

    I'm going to have to remember that one.
  • Options
    a_riot42a_riot42 Posts: 1,624
    Spire_Jeff wrote: »
    One thing I would REALLY like to see added is warnings for calls/functions that are not used. I would also like to see warnings about duplicate device definitions and unused devices. When you are dealing with thousands of lines of code, it is easy to forget about such things. I suppose I could always write a little java program that could do the check for me.... but right now I don't have the time to solve the problem, only enough time to whine about it :)

    Jeff

    This is pretty easy to do by activating a Perl script through the Tools menu.
    Paul
Sign In or Register to comment.