Click here to Skip to main content
15,913,487 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Coding styles Pin
Pete O'Hanlon29-Oct-10 10:00
mvePete O'Hanlon29-Oct-10 10:00 
GeneralRe: Coding styles Pin
Member 448708329-Oct-10 22:49
Member 448708329-Oct-10 22:49 
AnswerRe: Coding styles Pin
_Erik_29-Oct-10 10:06
_Erik_29-Oct-10 10:06 
AnswerRe: Coding styles Pin
Dave Kreskowiak29-Oct-10 10:25
mveDave Kreskowiak29-Oct-10 10:25 
AnswerRe: Coding styles Pin
T M Gray29-Oct-10 11:07
T M Gray29-Oct-10 11:07 
GeneralRe: Coding styles Pin
Member 448708329-Oct-10 23:10
Member 448708329-Oct-10 23:10 
GeneralRe: Coding styles Pin
T M Gray2-Nov-10 4:39
T M Gray2-Nov-10 4:39 
GeneralRe: Coding styles Pin
Member 44870832-Nov-10 7:53
Member 44870832-Nov-10 7:53 
T M Gray wrote:
So your call stacks aren't long and your methods are 1 or 2 lines. Yet your code does the same thing as something with methods 500 to 1000 lines long? Either you have 250+ methods, or you aren't comparing code with equivalent complexity.


Well, there's a balance between the two really. A single 1000 line method probably isn't ideal, and 1000 single line methods probably wouldn't be ideal either. Is there a problem with writing 250+ methods though? If you have a complex problem then you may create a number of classes and methods for it. Putting 250+ methods in a single class probably isn't great, but if you have that much code then it can probably be split up into multiple classes.

My call stack would be longer, but I wouldn't normally consider them to be too long. I generally don't see this to be an issue. It can also be useful when an exception is thrown and logged (or unhanlded). Exceptions give you the stack trace, and if an exception is thrown in a 500+ line method then it's likely to be more difficult pin point the problem than if it was a 10 line method.

You are right about the complexity in some ways. However, almost all of the long methods I see can easily be broken down into smaller parts. Even breaking them into methods with 100 lines of code would make the code much more readable.

Although I do write single line methods, a lot of code is more than a couple of lines long, but never 500+ lines.
GeneralRe: Coding styles Pin
Pete O'Hanlon2-Nov-10 8:04
mvePete O'Hanlon2-Nov-10 8:04 
GeneralRe: Coding styles Pin
Member 44870832-Nov-10 8:51
Member 44870832-Nov-10 8:51 
GeneralRe: Coding styles Pin
Pete O'Hanlon2-Nov-10 12:06
mvePete O'Hanlon2-Nov-10 12:06 
AnswerRe: Coding styles Pin
PIEBALDconsult29-Oct-10 16:34
mvePIEBALDconsult29-Oct-10 16:34 
GeneralRe: Coding styles Pin
Member 448708329-Oct-10 23:12
Member 448708329-Oct-10 23:12 
GeneralRe: Coding styles Pin
PIEBALDconsult31-Oct-10 4:27
mvePIEBALDconsult31-Oct-10 4:27 
GeneralRe: Coding styles Pin
Member 44870832-Nov-10 7:39
Member 44870832-Nov-10 7:39 
GeneralRe: Coding styles Pin
PIEBALDconsult2-Nov-10 18:22
mvePIEBALDconsult2-Nov-10 18:22 
GeneralRe: Coding styles Pin
Member 44870833-Nov-10 7:35
Member 44870833-Nov-10 7:35 
AnswerRe: Coding styles Pin
Abhinav S29-Oct-10 19:13
Abhinav S29-Oct-10 19:13 
AnswerRe: Coding styles [modified] Pin
Jeff Connelly17-Nov-10 3:42
Jeff Connelly17-Nov-10 3:42 
QuestionSeeking a binary read/write file stream class Pin
PIEBALDconsult28-Oct-10 15:45
mvePIEBALDconsult28-Oct-10 15:45 
AnswerRe: Seeking a binary read/write file stream class Pin
Luc Pattyn28-Oct-10 15:57
sitebuilderLuc Pattyn28-Oct-10 15:57 
GeneralRe: Seeking a binary read/write file stream class Pin
PIEBALDconsult28-Oct-10 16:57
mvePIEBALDconsult28-Oct-10 16:57 
GeneralRe: Seeking a binary read/write file stream class Pin
Luc Pattyn28-Oct-10 17:14
sitebuilderLuc Pattyn28-Oct-10 17:14 
GeneralRe: Seeking a binary read/write file stream class [modified] Pin
PIEBALDconsult28-Oct-10 17:21
mvePIEBALDconsult28-Oct-10 17:21 
AnswerRe: Seeking a binary read/write file stream class Pin
_Erik_29-Oct-10 3:10
_Erik_29-Oct-10 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.