Merge lp://qastaging/~ghugesss/xpad/code_refactor into lp://qastaging/xpad

Proposed by Sagar Ghuge
Status: Needs review
Proposed branch: lp://qastaging/~ghugesss/xpad/code_refactor
Merge into: lp://qastaging/xpad
Diff against target: 8138 lines (+3350/-3252)
21 files modified
src/fio.h (+7/-3)
src/help.c (+3/-1)
src/help.h (+3/-3)
src/prefix.h (+3/-3)
src/xpad-app.c (+239/-232)
src/xpad-grip-tool-item.c (+38/-39)
src/xpad-pad-group.c (+15/-11)
src/xpad-pad-properties.c (+144/-143)
src/xpad-pad.c (+1200/-1203)
src/xpad-periodic.c (+230/-207)
src/xpad-periodic.h (+7/-3)
src/xpad-preferences.c (+477/-491)
src/xpad-session-manager.c (+60/-57)
src/xpad-session-manager.h (+4/-0)
src/xpad-settings.c (+225/-210)
src/xpad-text-buffer.c (+137/-124)
src/xpad-text-view.c (+99/-100)
src/xpad-toolbar.c (+279/-269)
src/xpad-tray.c (+85/-75)
src/xpad-tray.h (+4/-0)
src/xpad-undo.c (+91/-78)
To merge this branch: bzr merge lp://qastaging/~ghugesss/xpad/code_refactor
Reviewer Review Type Date Requested Status
Arthur Borsboom code review no testing Needs Fixing
Review via email: mp+233722@code.qastaging.launchpad.net

Description of the change

https://wiki.gnome.org/Projects/GTK%2B/BestPractices

As our app is under GNOME so we need to follow the global coding style and also follow the header includes for .c files.

I have tested a code and working fine. As I know you will going to see lot of changes, so from onwards before accepting any patch from other contributors we ask him to also follow the standard coding style.

To post a comment you must log in.
Revision history for this message
Arthur Borsboom (arthurborsboom) wrote :

Hi Sagar,

I went through most of the code changes.
Some things I dislike, some things I like.
Let's see if we can agree on the parts.
I summarize below what I would like to see different.
Feel free to disagree and explain,

1. Split and group changes (and merge requests)

When working with other developers, in general it is better to produce small changes.
And if the changes are bigger, than at least group the different changes together.
In this merge proposal there are many different changes, with some I agree (which I would like to merge) and some I disagree, which I would like to request fixing.

Splitting the changes also makes it easier to find issues introduced by changes. It also makes it easier to undo a change.

So my request is to split the different changes. Below I try to do a start, since I discuss each group of changes by subject.

2. Order of includes

Agree totally. I would like to merge this directly.

3. Improving head guards

I Agree totally. I would like to merge this directly.

4. Improving function declarations by G_BEGIN_DECLS and G_END_DECLS

I Agree totally. I would like to merge this directly.

5. Removal of function prototypes by reordering functions

I am in a split here.
I agree that it is nicer and easier to maintain if these are removed.
I disagree since it sometimes make readability and therefore maintainability harder.

So, only if the readability of the code stays more or less the same, I am in favor of this. Two examples:

I do like the removal of the forward declaration in xpad-pad-group.c

I dislike reading the xpad-pad.c and xpad-app.c from the bottom to the top (instead of the other way around), and therefore I don't like this to be changed.

6. Reformatting of function parameters, each parameter on a new line.

I strongly dislike this. In my opinion this makes reading the code much harder.

I guess it comes from the old-fashioned Linux kernel coding rule: 80 character limit. I used to dislike it and I still dislike it. These days almost each developer has a screen with at least 200 characters if not 500.

Only when the function declaration becomes extremely long, breaking this line in two or three pieces might be better.

7. Reformatting of function and return type on a new line.

I guess this is better. This might be my Java coding habit from the old days.

/* good */
static void
xpad_undo_class_init (XpadUndoClass *klass)

/* bad */
static void xpad_undo_class_init (XpadUndoClass *klass)

I prefer the one defined by me as 'bad', but I don't think it changes readability a lot and the code conforms to the best practice.

***

In general, best practices are good, but are not the law. In my opinion if you have a good reason to disagree with the best practice, it is okay.

For me, most of the disagreements above have to do with readability and maintainability. And since I (we) are maintaining the software, I like to do this as easy as possible.

Again, everything is open for discussing.

Nevertheless, I would like you to start with discussion point 1.
Then I can merge all the subjects we agree on and we can discuss the others after that.

Cheers,
Arthur.

review: Needs Fixing (code review no testing)

Unmerged revisions

705. By Sagar Ghuge

Typo corrected.

704. By Sagar Ghuge

Code refactoring done.

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.

Subscribers

People subscribed via source and target branches