Merge lp://staging/~bijanbina/ginn/GIR into lp://staging/ginn

Proposed by Bijan Binaee
Status: Rejected
Rejected by: Stephen M. Webb
Proposed branch: lp://staging/~bijanbina/ginn/GIR
Merge into: lp://staging/ginn
Diff against target: 2447 lines (+1339/-977)
18 files modified
.directory (+6/-0)
configure.ac (+1/-0)
src/Makefile.am (+3/-2)
src/README (+5/-0)
src/bamf.c (+0/-48)
src/bamf.cpp (+48/-0)
src/config.c (+0/-200)
src/config.cpp (+202/-0)
src/config.h (+70/-27)
src/ginn.c (+0/-592)
src/ginn.cpp (+555/-0)
src/ginn.h (+60/-0)
src/gir.cpp (+47/-0)
src/gir.h (+70/-0)
src/header.h (+38/-0)
src/main.cpp (+137/-0)
src/xt.c (+0/-108)
src/xt.cpp (+97/-0)
To merge this branch: bzr merge lp://staging/~bijanbina/ginn/GIR
Reviewer Review Type Date Requested Status
Chase Douglas (community) Disapprove
Stephen M. Webb (community) Needs Fixing
Review via email: mp+72521@code.staging.launchpad.net

Description of the change

1. port GINN to c++
2. use string instead of char *
3. fix all error with c++ compiler
4. create Gwish class instead of wish struct
5. add Gwish Type (geusture Type) instead of config_attr[0] to make code more readable and replace it in all part of code
6. add Gwish TouchNum (Number of finger for gesture) instead of config_attr[1] to make code more readable and replace it to all part of code
5. create GINN object and create a dynamic callback for GINN object
6. use "new" instead of memloc
7. remove all global variable and embed all of them in class
8. create qt project file for ginn
9. use cout and cerr instead of fprintf
10. abstract the main file and create the code more functionally
11. test all new changes and check are they stable or not
12. create constractor for apps and make Gapps object instead it
13. create callback for device add , remove and change with object oriented concept
14. create GD_att struct to save and access device attributes
15. create device list vector
16. find device attribute with just having device ID!(perfectly useful)
17. make code more readable
18. add comment to code and use simple name for variable
19. add some option to wish.xml to define some gesture for only touchscreen
20. add some option to wish.xml to define some gesture for only touchpad
21. compatible fully with last GINN branch
---------------------------------------------------------------------------------------------------------------------------------------
##################<Define Gesture Run On Which Device>#####################
1. open wish.xml
2. find what gesture you want to classify for example you select some thing like this:

    <wish gesture="Drag" fingers="2">
      <action name="action5" when="update">
        <trigger prop="delta y" min="20" max="80"/>
        <button>4</button>
      </action>
    </wish>

3. change <wish gesture="Drag" fingers="2"> to
<wish gesture="Drag" fingers="2" screen="true">
4. if you want to your gesture run only on touchpad change screen prop to false else now your
gesture only run on touch screen
-------------------------------------------------------------------------------------------------------------------------------------

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

I have a number of issues with this proposal.

(1) You need to explicitly justify moving from C to C++. In particular, renaming all existing C sources to C++. What does the project gain from this? What are the possible repercussions (ie. what new problems are introduced and what new potential for error is obtained)? The renaming introduces a lot of noise that makes it difficult to evaluate the rest of the change.

(2) This merge marks most sources as executable. That is undesirable.

(3) What is the .directory file? It does not appear to be necessary to build the project.

(4) Please do not use ///-style or //!-style comments, use Javadoc-style (/**) comments for consistency with the style of other uTouch projects.

(5) The various classes implement their own containers. Is there a good reason not to use the (tested, dependable) standard library instead? One of the main advantages to porting to C++ is the ability to use the C++ library.

(6) None of this code is exception safe. When errors are encountered, resources are leaked or undefined behaviour is encountered.

(7) There is no cleanup: objects are created using new but never deleted.

(8) Class constructors are assigning initial values to members in the constructor body instead of using initializer lists. Most of the classes are C structs that rely on external code to maintain their invariants: what is the point of converting to C++ if the code is just non-OO style C? See http://en.wikipedia.org/wiki/Class_invariant.

(9) Why add a capital G or D to classes and function names? This does not contribute to readability in a positive way. If this is to represent words like "device" or "gesture", use those words. We are not experiencing a shortage of ASCII.

(10) Some variable names could reflect their purpose better: for example, what is "local" used for?

(11) "header.h" is not an acceptable header file name. Also, please do not create a single header file to include all other header files any source file might need. Headers should pull in only the minimal subset of headers they need to compile on their own. Never put a "using namespace" directive in a header file.

(12) GINN::Dadded catches an exception of type error_t, but there is no code inside the try-block that can throw such a type. The only exception possible from the try-block is std::bad_alloc.

(13) Please leave at least one blank line between function definitions for readability.

review: Needs Fixing
Revision history for this message
Bijan Binaee (bijanbina) wrote :
Download full text (3.4 KiB)

> I have a number of issues with this proposal.
>
> (1) You need to explicitly justify moving from C to C++. In particular,
> renaming all existing C sources to C++. What does the project gain from this?
> What are the possible repercussions (ie. what new problems are introduced and
> what new potential for error is obtained)? The renaming introduces a lot of
> noise that makes it difficult to evaluate the rest of the change.
>
> (2) This merge marks most sources as executable. That is undesirable.
>
> (3) What is the .directory file? It does not appear to be necessary to build
> the project.
>
> (4) Please do not use ///-style or //!-style comments, use Javadoc-style (/**)
> comments for consistency with the style of other uTouch projects.
>
> (5) The various classes implement their own containers. Is there a good
> reason not to use the (tested, dependable) standard library instead? One of
> the main advantages to porting to C++ is the ability to use the C++ library.
>
> (6) None of this code is exception safe. When errors are encountered,
> resources are leaked or undefined behaviour is encountered.
>
> (7) There is no cleanup: objects are created using new but never deleted.
>
> (8) Class constructors are assigning initial values to members in the
> constructor body instead of using initializer lists. Most of the classes are
> C structs that rely on external code to maintain their invariants: what is
> the point of converting to C++ if the code is just non-OO style C? See
> http://en.wikipedia.org/wiki/Class_invariant.
>
> (9) Why add a capital G or D to classes and function names? This does not
> contribute to readability in a positive way. If this is to represent words
> like "device" or "gesture", use those words. We are not experiencing a
> shortage of ASCII.
>
> (10) Some variable names could reflect their purpose better: for example,
> what is "local" used for?
>
> (11) "header.h" is not an acceptable header file name. Also, please do not
> create a single header file to include all other header files any source file
> might need. Headers should pull in only the minimal subset of headers they
> need to compile on their own. Never put a "using namespace" directive in a
> header file.
>
> (12) GINN::Dadded catches an exception of type error_t, but there is no code
> inside the try-block that can throw such a type. The only exception possible
> from the try-block is std::bad_alloc.
>
> (13) Please leave at least one blank line between function definitions for
> readability.

1: if you think renaming is getting you to trouble so i must do what to port to c++
2: No why you think so
3: i remove it if the code accepted
4: the comment is not part of code! please review the code not comment!
5: can you make instance in my code
6: can you make instance in my code
7: it's the c++ advantage unlike C it delete them automatically
8: it's only on some classes and it is because if we change it need to recreate a code fuly again!!
9: if you use a very long function name you made the developer get to pitfall it's the best way to simple the develop process and have various advantage
10: it use to create a local copy ...

Read more...

Revision history for this message
Chase Douglas (chasedouglas) wrote :
Download full text (3.5 KiB)

First, Stephen has noted many issues with the changes. I agree with all of them, so it makes sense to have them fixed before doing any further review of the code.

> 1: if you think renaming is getting you to trouble so i must do what to port
> to c++

It's not the renaming that is the problem. If the renaming provided some benefits it would be acceptable. However, the renaming here is to allow for C++ compilation. Thus, there needs to be worthwhile C++ usage or else we could just leave it as C.

This hits at a big issue with the changes. I don't think you fully understand C++, how to use it properly, and how to make code better and more readable with it. Ginn could benefit greatly from being converted to C++. However, these changes do not make the code better.

> 2: No why you think so

See the preview diff below. There are lines like:

=== modified file 'COPYING' (properties changed: -x to +x)

> 3: i remove it if the code accepted

The way to fix this is to remove it in your branch, commit the change, and then push it to this branch on launchpad.net. That will update the merge proposal.

> 4: the comment is not part of code! please review the code not comment!

Comments are just as important as the code. Style matters in keeping things readable. Thus, we review comments too.

> 5: can you make instance in my code
> 6: can you make instance in my code

These are very basic and fundamental concepts of how to write C++. You are asking us to teach you C++. Unfortunately, we don't have enough time to do that. Instead, please try to learn C++ best practices by reading books or searching online for information.

> 7: it's the c++ advantage unlike C it delete them automatically

No, that is incorrect. You must delete C++ objects created with new.

> 8: it's only on some classes and it is because if we change it need to
> recreate a code fuly again!!

This is part of the fundamental aspects of C++. It needs to conform to normal C++ coding standards.

> 9: if you use a very long function name you made the developer get to pitfall
> it's the best way to simple the develop process and have various advantage

There are many possible ways to name functions, with many different reasons for why they are named a certain way. Normally, you should try to stay consistent with the existing code, and ensure that the names are obvious. Adding 'G' and 'D' to the beginning of function names does not have an obvious meaning.

> 10: it use to create a local copy of ginn object that is load for device .it's
> show the duty fully

You can name it "ginn" or something more descriptive. "local" is too generic for a variable name.

> 11: i like this way;also adding header not make your software slow!

You can add a header, that's not the issue. The issue is that the name of the header is too generic. The name needs to give some idea as to what is defined in the header.

> 12: it's an static error ,add error_t is for just through of the compiler
> error. also use error_t for dynamic error.

I don't think you understand how exceptions work. Please look up C++ exception handling.

> 13: the comment is not part of code! please review the code not comment!

This has nothing t...

Read more...

review: Disapprove

Unmerged revisions

90. By Bijan Binaee

GIR

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.