Skip to main content

All Questions

3 votes
1 answer
11k views

Design Patterns for dependent sequential validation

I have three validators each sequentially dependent on the previous. I might use all three or only the first two or only the first one. E.g. Validator 1: Checks whether user exists Validator 2: ...
user avatar
8 votes
3 answers
4k views

Avoiding spaghetti code while writing small functions

My understanding of "Spaghetti Code" is a code base that jumps from one block of code to another without an logical and legible purpose. The most common offender seems to be the GOTO statement. I'm ...
Chris's user avatar
  • 1,683
1 vote
3 answers
120 views

How to properly structure functions?

let's say we have a class with some methods in it, of which at least one is of rather complex nature: class Example { public function Example() { } private function complexFunction():...
Reign_of_Light's user avatar
64 votes
6 answers
75k views

How many lines of code should a function/procedure/method have? [duplicate]

Possible Duplicate: When is a function too long? I've recently been given the unenviable task of reviewing poor code written by another developer and documenting the bad practices. (This is all for ...
Alex Angas's user avatar
  • 60.1k
151 votes
24 answers
83k views

When is a function too long? [closed]

35 lines, 55 lines, 100 lines, 300 lines? When you should start to break it apart? I'm asking because I have a function with 60 lines (including comments) and was thinking about breaking it apart. ...