Coding Style Guidelines and Git/GitHub Workflow

About the actual programming of the game.

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby Pseudonym » Fri Aug 30, 2013 1:01 am

Andrew wrote:80 characters wide yes, no line limit though. However a very long function is indicative of code smell and you should investigate it and consider refactoring.

I agree, but I don't think that 25 lines is "very long" by modern standards. Around the 100 line mark is where you should start thinking about refactoring.

However, I would like to stress this is indicative of a smell. Some functions are large because they have an inherently ugly job to do which can't be avoided. Don't split up functions just because they're big, and do put some thought into how you split them up. In particular, avoid the Chinese duck algorithm (the split occurs wherever the cleaver happens to fall).
Pseudonym
 
Posts: 129
Joined: Tue Aug 13, 2013 3:54 am

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby Andrew » Fri Aug 30, 2013 1:04 am

Pseudonym wrote:
Andrew wrote:80 characters wide yes, no line limit though. However a very long function is indicative of code smell and you should investigate it and consider refactoring.

I agree, but I don't think that 25 lines is "very long" by modern standards. Around the 100 line mark is where you should start thinking about refactoring.

However, I would like to stress this is indicative of a smell. Some functions are large because they have an inherently ugly job to do which can't be avoided. Don't split up functions just because they're big, and do put some thought into how you split them up. In particular, avoid the Chinese duck algorithm (the split occurs wherever the cleaver happens to fall).


I was never suggesting that 25 lines was very long. But yes, some functions will need to be longer by their nature. Programmers should just use their common sense, as should people doing code reviews.
IRC: |Andy|
Andrew
 
Posts: 110
Joined: Wed Aug 21, 2013 7:16 am
Location: Melbourne, Australia

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby mrout » Fri Aug 30, 2013 6:20 am

Pseudonym wrote:
Andrew wrote:80 characters wide yes, no line limit though. However a very long function is indicative of code smell and you should investigate it and consider refactoring.

I agree, but I don't think that 25 lines is "very long" by modern standards. Around the 100 line mark is where you should start thinking about refactoring.

However, I would like to stress this is indicative of a smell. Some functions are large because they have an inherently ugly job to do which can't be avoided. Don't split up functions just because they're big, and do put some thought into how you split them up. In particular, avoid the Chinese duck algorithm (the split occurs wherever the cleaver happens to fall).


That's why it's a code smell, and not automatically a code rot.

Really, the best thing to do is to say "It's a code smell if you can't read a whole function on one average-sized screen", IMO not necessarily because long functions are inherently bad, but that functions (and class definitions) that take up more than a screen are hard to read and therefore hard to understand.

Although if your class or function definition is that long it probably is doing too much. See http://c2.com/cgi/wiki?GodClass
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby danix111 » Wed Sep 25, 2013 4:46 am

Are we still going with this?
User avatar
danix111
 
Posts: 61
Joined: Mon Aug 12, 2013 2:05 pm
Location: Gdynia, Poland

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby DarkSpartan » Wed Sep 25, 2013 5:44 am

No idea. I heard some grousing about it earlier today, so I expect there to be some sort of revision. What form that will take is anyone's guess.
DarkSpartan
Lead Designer
 
Posts: 100
Joined: Mon Aug 12, 2013 10:45 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby kibbles » Fri Sep 27, 2013 2:19 pm

Honestly, having just read through the thread, these are all pretty reasonable requests. We could change it on the off chance that adam likes memory leaks more than mrout.
User avatar
kibbles
 
Posts: 49
Joined: Mon Aug 19, 2013 12:56 pm

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby adam » Fri Sep 27, 2013 2:35 pm

I don't want any memory leaks, but sadly things happen especially with this many programmers on a new project and clean code base.
adam
 
Posts: 113
Joined: Tue Aug 20, 2013 11:58 am

Re: Coding Style Guidelines and Git/GitHub Workflow

Postby Longor1996 » Fri Mar 07, 2014 12:32 pm

You could also go the hard route and implement a small Garbage-Collector into Sigma, then be lazy and use it whereever it would work without problems.
That's just an Idea.

Memory-Leaks would still happen though. :/

Have a nice day.

- Longor1996
#define Longor1996 "Programmer that loves to write small tools for quick usage. He writes code mainly in Java, but understands C++ and similar languages as well. Is also reading science articles/books/papers/news since he is 5 years old".
User avatar
Longor1996
 
Posts: 14
Joined: Mon Aug 19, 2013 11:00 pm

Previous

Return to Code

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron