Thread: [Tuxpaint-devel] Well organized and commented code of my animation application
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Ajay K. <nit...@gm...> - 2008-04-16 15:23:04
|
Dear sir, I have taken some time out of my final exams preparation time and have edited my code. Now i have my code in a well organized manner and is commented to the possible extent. The commented code is uploaded here. http://www.uploadcomet.com/download.php?file=6b7e2d553a76f09fca38eafba762e0c6. The necessary images, configuration files, fonts and character file are also included. I have compiled this edited code on my system. It is getting compiled without any errors. Please take a took at my commented code, i hope it makes sense as it is commented. Regards, AJAY KUMAR CHINTALA. |
|
From: Mark K. K. <mkk...@gm...> - 2008-04-17 00:26:17
|
On Wed, Apr 16, 2008 at 08:52:54PM +0530, Ajay Kumar wrote: > I have taken some time out of my final exams preparation time and have > edited my code. Now i have my code in a well organized manner and is > commented to the possible extent. The commented code is uploaded here. > [1]http://www.uploadcomet.com/download.php?file=6b7e2d553a76f09fca38eafba762e0c6. Ajay, I skimmed through your code and have some bad news. I'm not very confident in your coding skills after having read through your source codes. Here is some feedback to help you improve your coding style: 1. There are too many comments. You were right about earlier - the code should be self-documenting as much as possible and contain just enough comments where clarification is needed. Also, this is not as critical, but all things being equal the comments should adhere to the standard C comments using /* ... */ rather than the C++-style (a.k.a. BCPL-style) comments. This is to be compatible with older compilers on non-standard platforms whenever possible. This depends on your target platforms, however. 2. Indentations are inconsistent and incomprehensible. Some indentations are 0 spaces while I've found a location with 25 spaces (not tabs that result in 25 spaces) as the indentation. I also found a place that had 2 space indentation at the opening bracket but 5 space indentation at the closing bracket, which is misleading. This is not only irregular (which would be a minor annoyance) but this makes code hard to read and bug-prone. This is a huge problem that should be obvious from the beginning. 3. Header files contain functions! Header files should not contain functions (except macros, and also inline functions and templates when writing C++ codes) but the functions should be included in separate .c files. The header files should contains appropriate multi-C file This is an important concept to understand, but probably not something you'd be expected to know at this point in your career so I wouldn't count it against you, though. 4. The main function is too long. It should be broken down to smaller functions if possible. (Tux Paint, however, also suffers from the same problem, a problem I hope will be corrected sometime in the future.) 5. You shouldn't need to add comments or clean up the code for us. The code you write on a daily basis should stay relatively clean most of the time and fairly presentable without much modification. It appears you made a lot of effort to add all these comments which troubles me, because it shows the code you normally write is not very clean and requires a lot of work to clean up. However, do not take my comments too critically at this point in your career. I would not expect you to be able to know or do any of the above with expertise at this point in your career juncture as a university student EXCEPT #2. #2 should be fairly obvious even to a beginning programming student and I would expect a decent programmer at a university program to have made at least some effort to correct them while one was writing the code. Codes without decent indenting often create buggy and hard to read code and that will harm a project more than help it. I'm not sure if I'll be able to help you here. Other mentors may feel differently but I'm afraid I cannot endorse your application this year. I hope you improve your coding skills and apply again next year. Regards, -Mark |
|
From: Pere P. i C. <pe...@fo...> - 2008-04-18 11:15:24
|
Hi Ajay! El dc 16 de 04 de 2008 a les 20:52 +0530, en/na Ajay Kumar va escriure: > The commented code is uploaded here. > http://www.uploadcomet.com/download.php?file=6b7e2d553a76f09fca38eafba762e0c6. The necessary images, configuration files, fonts and character file are also included. I have compiled this edited code on my system. It is getting compiled without any errors. Please take a took at my commented code, i hope it makes sense as it is commented. Some problems I've find compling under linux: pere@hola:/tmp/commented code$ LC_ALL=C gcc -I /usr/include/SDL -lSDL -lSDL_ttf AniMe.c -o Anime AniMe.c:6:21: error: SDL_TTF.h: No such file or directory In file included from AniMe.c:9: main.h:9: warning: parameter names (without types) in function declaration In file included from AniMe.c:15: rendering.h: In function 'drawText': rendering.h:5: error: 'TTF_Font' undeclared (first use in this function) rendering.h:5: error: (Each undeclared identifier is reported only once rendering.h:5: error: for each function it appears in.) rendering.h:5: error: 'font' undeclared (first use in this function) rendering.h:9: warning: initialization makes pointer from integer without a cast AniMe.c: In function 'main': AniMe.c:3348: error: 'TTF_Quit' undeclared (first use in this function) It seems a case sensitive problem, in linux I have a SDL_ttf.h under /usr/include/SDL, so just correcting the spelling in AniMe.c solves this. Next problem, itoa function seems not be available in linux. pere@hola:/tmp/commented code$ LC_ALL=C gcc -I /usr/include/SDL -l SDL -l SDL_ttf AniMe.c -o Anime In file included from AniMe.c:9: main.h:9: warning: parameter names (without types) in function declaration /tmp/ccTA5ioG.o: In function `cursor_pos': AniMe.c:(.text+0x12755): undefined reference to `itoa' AniMe.c:(.text+0x12772): undefined reference to `itoa' collect2: ld returned 1 exit status Googling for this, seems that it should be replaced by sprintf or snprintf. I am unable to compile further. Hope this helps Pere Note, since you are developing under windows, you migth want to check those pages about compiling tuxpaint under windows: http://johnnypops.demon.co.uk/mingw/index.html http://johnnypops.demon.co.uk/mingw-old/index.html |
|
From: Schrijvers L. <Be...@sk...> - 2008-04-18 12:19:53
|
Hi there,
same problem wiht the case sensitive problem in ZETA(BeOS), aside from
that, quite some parse errors (gcc 2.95.3) in a few files, after I added
the {} the compiles goes ahead but when it finishes it doesn't seem to
compile the binarie (maybe it stops somewhere but I don't have any real
output in the Terminal).
$ LC_ALL=C gcc -I /boot/home/config/include/SDL -lSDL -lSDL_ttf AniMe.c
-o AniMe
In file included from /boot/home/Desktop/commented code/AniMe.c:9:
/boot/home/Desktop/commented code/main.h:9: warning: parameter names
(without types) in function declaration
/boot/home/Desktop/commented code/AniMe.c:63: `close' redeclared as
different kind of symbol
/boot/develop/headers/posix/unistd.h:18: previous declaration of `close'
Regards,
Luc aka Begasus
On vr, 2008-04-18 at 13:15 +0200, Pere Pujal i Carabantes wrote:
> Hi Ajay!
>
> El dc 16 de 04 de 2008 a les 20:52 +0530, en/na Ajay Kumar va escriure:
>
> > The commented code is uploaded here.
> > http://www.uploadcomet.com/download.php?file=6b7e2d553a76f09fca38eafba762e0c6. The necessary images, configuration files, fonts and character file are also included. I have compiled this edited code on my system. It is getting compiled without any errors. Please take a took at my commented code, i hope it makes sense as it is commented.
>
> Some problems I've find compling under linux:
>
> pere@hola:/tmp/commented code$ LC_ALL=C gcc -I /usr/include/SDL -lSDL
> -lSDL_ttf AniMe.c -o Anime
> AniMe.c:6:21: error: SDL_TTF.h: No such file or directory
> In file included from AniMe.c:9:
> main.h:9: warning: parameter names (without types) in function
> declaration
> In file included from AniMe.c:15:
> rendering.h: In function 'drawText':
> rendering.h:5: error: 'TTF_Font' undeclared (first use in this function)
> rendering.h:5: error: (Each undeclared identifier is reported only once
> rendering.h:5: error: for each function it appears in.)
> rendering.h:5: error: 'font' undeclared (first use in this function)
> rendering.h:9: warning: initialization makes pointer from integer
> without a cast
> AniMe.c: In function 'main':
> AniMe.c:3348: error: 'TTF_Quit' undeclared (first use in this function)
>
> It seems a case sensitive problem, in linux I have a SDL_ttf.h
> under /usr/include/SDL, so just correcting the spelling in AniMe.c
> solves this.
>
>
> Next problem, itoa function seems not be available in linux.
>
> pere@hola:/tmp/commented code$ LC_ALL=C gcc -I /usr/include/SDL -l SDL
> -l SDL_ttf AniMe.c -o Anime
> In file included from AniMe.c:9:
> main.h:9: warning: parameter names (without types) in function
> declaration
> /tmp/ccTA5ioG.o: In function `cursor_pos':
> AniMe.c:(.text+0x12755): undefined reference to `itoa'
> AniMe.c:(.text+0x12772): undefined reference to `itoa'
> collect2: ld returned 1 exit status
>
> Googling for this, seems that it should be replaced by sprintf or
> snprintf. I am unable to compile further.
>
>
>
>
> Hope this helps
> Pere
>
> Note, since you are developing under windows, you migth want to check
> those pages about compiling tuxpaint under windows:
>
> http://johnnypops.demon.co.uk/mingw/index.html
> http://johnnypops.demon.co.uk/mingw-old/index.html
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Tuxpaint-devel mailing list
> Tux...@li...
> https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel
|