Jump to content
Mike Torrettinni

Is it really that bad to Use boolean parameters to make your functions do two things?

Recommended Posts

2 minutes ago, Mike Torrettinni said:

Perhaps it would be better something like ControlWindow.Enable() or ControlWindow(wnd, cwEnable) or ControlWindow(wnd, [cwEnable, cwActive]) with type TControlWindow = (cwEnable, cwDisable, cwActive, csFocused...);

In some cases - yes. Imho, it's a kind of subjective things.

Share this post


Link to post
Just now, David Heffernan said:

It's as if the thread above never happened!!!! 

 

Please read first post to see what the topic is about, I think it's got all the info. If something is not clear, let me know.

Share this post


Link to post
21 hours ago, balabuev said:

ShowWindow(wnd, SW_HIDE);

There is multiple SW_* variants so the example is irrelevant...

21 hours ago, balabuev said:

EnableWindow(wnd, FALSE);

Nice sample of bad naming, yes. Ideally it should be SetWindowEnabled IMHO

Share this post


Link to post
14 minutes ago, Fr0sT.Brutal said:

There is multiple SW_* variants so the example is irrelevant...

Just more generalized case of the same concept:

  • Can ShowWindow be used to hide the window? Yes.
  • Can EnableWindow be used to disable the window. Yes.
23 minutes ago, Fr0sT.Brutal said:

Nice sample of bad naming, yes.

This style of naming is a bias towards minimalism. And, imho, being used carefully - it's quite adequate.

 

 

Share this post


Link to post
On 1/8/2021 at 2:27 PM, Lars Fosdal said:

Two books that are gold for picking up good coding habits - even this long after they were written:

Code Complete 2nd Edition by Steve McConnell

Framework Design Guidelines by Krzysztof Cwalina & Brad Abrams (Third Edition)

I have to repeat this comment.  Among other things, these books give excellent advice on naming conventions.

  • Thanks 1

Share this post


Link to post
Guest
14 minutes ago, Lars Fosdal said:

Among other things, these books give excellent advice on naming conventions.

Чукча – не читатель, чукча – писатель !

 

I am sorry but couldn't help my self :classic_biggrin: , hope this will draw a smile on Russian speaking readers, also i don't know how to translate it right with its context, so help is appreciated here.

Share this post


Link to post
1 hour ago, Kas Ob. said:

Чукча – не читатель, чукча – писатель !

 

I am sorry but couldn't help my self :classic_biggrin: , hope this will draw a smile on Russian speaking readers, also i don't know how to translate it right with its context, so help is appreciated here.

I guess this is the English counterpart: Chuck Norris doesn't read books, he just stares them down until they give him the information he needs. 😉 

 

I think Mr. Triviality will show up now and send us all home for wasting his time. Perhaps he will tell us this twice! 🙂

Edited by Mike Torrettinni

Share this post


Link to post
Guest
18 minutes ago, Mike Torrettinni said:

I guess this is the English counterpart: Chuck Norris doesn't read books, he just stares them down until they give him the information he needs. 😉 

It is more like this :

I can write, so why i should read ?!

Share this post


Link to post

Since the main untranslatable word is already "translated" as Chuck Norris :classic_biggrin: the rest is simple:

 

Chuck Norris doesn't read books, instead Chuck Norris write books.

Edited by balabuev
  • Like 1
  • Haha 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×