• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Code reviews

I very rarely ever write private methods and in fact I would have them banned, I cant see the point of splitting up a large public method into smaller private methods. It does make the readability of the code much worse as you have to use the IDE then to follow the code looking for calls rather than moving down one large method.
Splitting bits of a large public method into several private methods just to make the method smaller... well I can see your point here although if there are distinct sub-functions I would probably consider it when the method got too long.

BUT, typically these private methods are bits of functionality used by more than one public method, but not safe to call directly from outside the class.

Are you from a C background?
 
tulip, that's even what we did in procedural programming, before OO was invented!

Well that is exactly it. "I have a block of code and I am going to put this block of code here", it is thinking for morons who cant see a bigger picture in the code design.
 
If you have one 100 line method any reusable elements should be placed into a reusable public method in an object itself, I rarely If ever have an object call methods on the same object, again I don't have methods call private methods.

If you can do that it is worse taking a 100 line method and splitting it into 10 10 line private methods gives you 110 lines of code and 11 methods, you have taken a clean interface with one method and turned it into a mess of 11 methods, to understand the code takes longer as code should be understood reading the interface not the code. You have leaked what was a less than ideal 100 line method but one that was encapsulated into poor API. Interface should always be king.

Clearly you client has seen what you have done and though the same, else you would not be on here pissing your knickers about getting slated at code review time and looking for some affirmation which you only seem to be getting from the assorted cretins clique of CUK.

The example you have given is just plain rubbish. Why would someone split a method into 10 10 line private methods. You would split the code for all the reasons I have talked about. You don't just say I know lets try and split this into chunks of 10.

Again, I hope I never have the opportunity to work with your code. Your a know it all and when confronted with a valid argument you insult, choose to ignore it or provide unrelated silly examples to confuse the issue.
 
lol

lol

Are you one of those excel-monkey (clueless) PMs who has to manufacture importance for themselves? :tongue

Yes if you discount my 15 years as a hard nosed coder in RPG II, III, ILE, FREE before I became a clueless PM
 
Again, I hope I never have the opportunity to work with your code. Your a know it all and when confronted with a valid argument you insult, choose to ignore it or provide unrelated silly examples to confuse the issue.

If you want a serious professional discussion on tech keep it in tech, this is general and I will treat the assorted idiots that are assembled in front of me with the contempt that they deserve.
 
I very rarely ever write private methods and in fact I would have them banned, I cant see the point of splitting up a large public method into smaller private methods. It does make the readability of the code much worse as you have to use the IDE then to follow the code looking for calls rather than moving down one large method.

Almost all IDE's/editors allow you to easily navigate between method calls. Code becomes much more readable when you have smaller methods that are properly named i.e.

if (isCardVerified()) {

//do stuff
}

rather than repeating the perhaps complex code inside isCardVerified every time.
 
Last edited: 10:14
I very rarely ever write private methods and in fact I would have them banned, I cant see the point of splitting up a large public method into smaller private methods. It does make the readability of the code much worse as you have to use the IDE then to follow the code looking for calls rather than moving down one large method.

This is comedy gold. You can never, and I mean never ever, Lawd it over anyone here technically ever again.

EN-CAP-SHOE-LAY-SHUN.

HTH BIKIW
 
He's of the old school. Nothing wrong with that as long as nobody hires him to work on a project using modern methodologies or languages.
 
If you want a serious professional discussion on tech keep it in tech, this is general and I will treat the assorted idiots that are assembled in front of me with the contempt that they deserve.

If you offered persuasive arguments I would have listened because I'm willing to learn. But you choose to insult, ignore and confuse with silly examples.
 

Advertisers

Back
Top