[GRASS-dev] code examples

Hello devs,

I was wondering if you could provide me with an example of GRASS’ code that would look
obscure and complicated to a non-experienced programmer, but that at the same time is
nicely explained by the comments (maybe with some pseudo-code)?

I’m looking into that with teaching and (it’s a long shot but…) academic intents.

thanks


Prof. Carlos Henrique Grohmann
Institute of Geosciences - Univ. of São Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com


Can’t stop the signal.

Sent with Sparrow

Hi.

Thanks for the answers, but I feel I need to explain myself a bit better.

I’m not looking for example codes (like r.example or v.example), I’m looking for real code,
but more specifically, some piece of code that was wrote in a way that my look confusing
to a beginner programmer, but that is well explained in the comments.

for instance, (python):

actual code:

remove file extensions, join all names and remove white spaces (all at once)

self.nomMerge = ‘Merge_’ + ‘’.join([‘’ if i == ’ ’ else i for i in ‘_’.join([i[:-4] for i in nomMerge])]) + ‘.txt’

explained in comments:

this line is the same as:

a = [i[:-4] for i in nomMerge] # remove file extensions

b = ‘_’.join(a) # first join

c = [‘’ if i == ’ ’ else i for i in b] # remove white spaces

d = ‘_’.join(c) # second join

e = ‘Merge_’ + d + ‘.txt’

I don’t speak C or C++, but I know this kind of situation can happen, so
I’m looking for examples such as the above but in C, or C++

best

Carlos


Prof. Carlos Henrique Grohmann
Institute of Geosciences - Univ. of São Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com


Can’t stop the signal.

Sent with Sparrow

On Sunday, 22 April 2012 at 01:02, Carlos Grohmann wrote:

Hello devs,

I was wondering if you could provide me with an example of GRASS’ code that would look
obscure and complicated to a non-experienced programmer, but that at the same time is
nicely explained by the comments (maybe with some pseudo-code)?

I’m looking into that with teaching and (it’s a long shot but…) academic intents.

thanks


Prof. Carlos Henrique Grohmann
Institute of Geosciences - Univ. of São Paulo, Brazil

  • Digital Terrain Analysis | GIS | Remote Sensing -

http://carlosgrohmann.com


Can’t stop the signal.

Sent with Sparrow