Connect IQ feedback

I am the author of the BadmintonScoreTracker for the fenix 3 (which can be found here). I just pushed the source code on Github (here).

I would like to give my feedback on ConnectIQ. I am not sure this forum is the best place to do this, but here are my comments:


MonkeyC:
-"For loop" may not have an increment phase (see here https://github.com/matco/badminton/blob/master/source/model/Helpers.mc#L12, please let me choose when I would like to increment variable i).

-Support shapes in layout. In my application, I draw a badminton court (see picture here) and I must have control of each corner of the court to be able to change their color. If I put this in a drawable, this is no more possible. Except, of course, if I put every corner in its own drawable.

-Is there a way to reference a resource string directly in a label (in order to avoid doing this for localization https://github.com/matco/badminton/blob/master/source/MainView.mc#L20)? Am I missing something?

-Advanced drawable position in xml layouts. I would like to be able to write this:
<label x="center - 5" y="center + 10" />
It is a pity to position labels programmatically, it ruins the concept of layout per device or language.

-Advanced string format (like the one I wrote here https://github.com/matco/badminton/blob/master/source/model/Helpers.mc#L7). When you translate the application, parameters may appear in different orders depending on the language, that is why named parameters are way better.

-Add a class List (like this one https://github.com/matco/badminton/blob/master/source/model/List.mc). We are in 2015, I don't want to play with a fixed size array.

-Add a class Assert (like this one https://github.com/matco/badminton/blob/master/source/model/Assert.mc). Because every code must be tested!

Plugin Eclipse:
-When you double click on text in a .mc file to make a selection, you get a really weird selection (try to double click anywhere on this line https://github.com/matco/badminton/blob/master/source/model/Helpers.mc#L15, it will select the whole paragraph).

-Do not parse keywords in strings (try to view this line in Eclipse https://github.com/matco/badminton/blob/master/source/test/ListTest.mc#L7).

Sample application:
When you create a new application using Eclipse plugin, some classes are automatically created. It is a bit weird to put class MainViewDelegate in Application.mc file. It would be better in MainView.mc.

During publication on an application:
-Preserve order of uploaded pictures so they appear in the same order on the store application page.


These are just my comments. I may have misunderstood some behaviors or be totally wrong. Feel free to comment the code of my application and show me my mistakes. I will be more than happy to fix or improve the code.

Anyway, I love my fenix 3, you've done a great job with this product! Thanks!

Matthieu.
  • I'll take more time to respond to each of these individually, but I'll mention now that many of the things you mention we either already have plans to address or we agree that they're needed. :) I'll be sure to pass your feedback on and report anything that we don't already have on the road map. We appreciate your thoughtful feedback!

    By the way, your Badminton app looks really well-done!

    EDIT: There have already been a lot of good responses, so I won't rehash anything. I have made sure that everything has been reported if it's not already on our list.
  • Former Member
    Former Member over 10 years ago
    I haven't checked these, so I may have made an error or two, but..

    -"For loop" may not have an increment phase (see here https://github.com/matco/badminton/blob/master/source/model/Helpers.mc#L12, please let me choose when I would like to increment variable i).

    The loop just needs a condition. so you can use
    for(var i = 0; i < x; i = i )

    -Is there a way to reference a resource string directly in a label (in order to avoid doing this for localization https://github.com/matco/badminton/blob/master/source/MainView.mc#L20)? Am I missing something?

    If I have understood what your asking for, I believe you will find you can access the label by it's layout index, eg
    myLayout[0].setText(Rez.Strings.welcome_who_start);

    -Advanced drawable position in xml layouts. I would like to be able to write this:
    <label x="center - 5" y="center + 10" />
    It is a pity to position labels programmatically, it ruins the concept of layout per device or language.

    While not quite as automated as you would like, you can come close with xml dtd.
    <?xml version="1.0" standalone="yes" ?>
    <!DOCTYPE layout [
    <!ENTITY ctrX "103">
    <!ENTITY ctrY "74">
    ]>
    <layout id="myLayout">
    <label id="label0" x="&ctrX; - 5" y="&ctrY; + 10" />
    </layout>



    Plugin Eclipse:
    -When you double click on text in a .mc file to make a selection, you get a really weird selection (try to double click anywhere on this line https://github.com/matco/badminton/blob/master/source/model/Helpers.mc#L15, it will select the whole paragraph).

    I find..
    1 click. Position cursor
    2 clicks. Select word
    3 clicks. Select line


    I agree wholeheartedly with you on the rest.
  • -"For loop" may not have an increment phase (see here https://github.com/matco/badminton/blob/master/source/model/Helpers.mc#L12, please let me choose when I would like to increment variable i).


    While I don't disagree with this request, in this instance it seems that you're trying to force a square peg into a round hole.

    Typically, when the number of iterations is known in advance you would use a for loop, otherwise you'd use a while or do/while. I realize that this is a style issue, many consider this to be 'the way'. I have experience with C/C++ static analysis tools that flag such usage (either changing the variable i inside the loop and in the increment-expression, or omitting the increment-expression) as a potential error (see MISRA-C Rule 13.5, 13.6, 14.6).

    In your code, the number of iterations is actually the number of ${...} tokens in the input string, not the number of possible tokens, so you don't really know the number of iterations until you've walked the string. If you had written your loop as two loops (one to iterate over parameters, and the other to iterate over matches), it would make a lot more sense and would avoid the problem entirely.

    for (var parameter = 0; parameter < parameters_keys.size(); ++parameter) {

    var parameter_key = "${" + parameter_keys[parameter] + "}";
    var parameter_index = result.find(parameter_key);

    while (parameter_index != null) {
    var result_before = parameter_index > 0 ? result.substring(0, parameter_index) : "";
    var result_after = result.substring(parameter_index + parameter_key.length(), result.length());
    result = result_before + parameters[parameters_keys] + result_after;

    parameter_index = result.find(parameter_key);
    }
    }

    [/code]
  • First of all, thank you for your replies.

    @Brandon.ConnectIQ
    I can't wait to see new versions.

    @TRAVIS.VITEK
    You are obviously right, but like you said, it is more a question of style. I personally prefer my trick until someone tells me why this is bad (I didn't found an interesting explanation after googling the -closed- standard you mentioned).

    @SHARKBAIT_AU
    About labels: the problem is not to find the label in the layout, it is that you have to set the text programmatically to localize your label. In my application, I have two resource files for strings (one in English and the other in French) and Rez.Strings returns automatically the string in the good language. It would be nice if you can reference directly the id of the string in the label tag inside the layout XML file. Then the framework could retrieve the string in the good language and use it directly.

    Regarding drawable positions in layout. I don't need constants. I just need the framework to interpret formula for x and y attributes. Here are better examples.
    <label x="center - 5" y="center + 10" />
    <label x="right - 10" y="bottom - 45" />

    center, right or bottom should be replaced by their values automatically.

    For the last point, with some pieces of code my Eclipse selects the whole paragraph when I double click.
  • Former Member
    Former Member over 10 years ago
    Re: language. You are aware that you can include, for example, a resources-fr folder, and have your french strings in the layout label text attribute? The framework will then apply the correct strings based on the device language setting.

    Re: position. I realize you want the values to be automatic. The reason I showed you the example is because the values aren't automatic. You don't want to apply the absolute values, my example shows how to emulate the behavior you desire.
  • I think that there are differences between eclipse for Mac OS and for Windows. On windows when i double click, only one word is selected (and that is desired behaviour). On Mac OS sometimes is one word, but almost every time it... I don't know what... a piece of code without any sense:)

    I will not start new topic, but found probably new bug:
    There is no possibility to make something like this:
    var x = 353.35 % 7; //float modulo does not work
    I have to make it
    var x = 353 % 7 + 0,35; //integer modulo works
  • I think that there are differences between eclipse for Mac OS and for Windows. On windows when i double click, only one word is selected (and that is desired behaviour). On Mac OS sometimes is one word, but almost every time it... I don't know what... a piece of code without any sense:)

    I will not start new topic, but found probably new bug:
    There is no possibility to make something like this:
    var x = 353.35 % 7; //float modulo does not work
    I have to make it
    var x = 353 % 7 + 0,35; //integer modulo works


    Yeah I ran into that as well with my Daylight Left datafield. I created a module called MathExtra with a lot of handy little functions it in, two of them are:

    // Returns a `Number` representing the modulus of two `Float` inputs.
    //
    // The builtin modulo operator % only works for integers. This function
    // provides the same functionality for Floats.
    function fmod(dividend, divisor) {
    var n = (dividend / divisor).toNumber();
    return dividend - (n * divisor);
    }

    // Returns a `Number` representing the positive modulus of two `Float` inputs.
    //
    // For example fmod(-1, 24) is -1, but fmodPositive(-1, 24) is 23.
    function fmodPositive(dividend, divisor) {
    var val = fmod(dividend, divisor);
    if (val < 0) {
    val += divisor;
    }
    //System.println("dividend=" + dividend.toString() + " divisor=" + divisor.toString() + " val= " + val.toString());
    return val;
    }


    I'd like to open source some of that code on Github soon.