|
It depends!
1) If the section of code is executed frequently, then #2 adds the cpu overhead of the call/return therefore slowing the program down.
2) If the DoSomething code is relatively simple and is only used in this one location, then it should be coded in place in order to make readability, understandability and comprehension better.
3) If the Dosomething code is frequently used code, then #1 makes it clearer when something is done.
The answer to this question is a choice of balancing performance vs readability vs understandability vs comprehension.
To me, code should always be written such that I or anyone else can comprehend the intent and methodology of the original programmer in a few seconds.
|
|
|
|
|
The answer is a clear "Depends!"
|
|
|
|
|
First. I prefer only calling logic when the situation warrants. You always call MaybeDoSomething in the second, even if it really does nothing...
|
|
|
|
|
Should you never trust stairs, because they are always up to something?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You can only trust them when you're at the bottom. Then they're only on the up and up.
Keep Calm and Carry On
|
|
|
|
|
Well that escalated quickly!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
There's always a down side.
The less you need, the more you have.
Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?
JaxCoder.com
|
|
|
|
|
Rail-y, watch your step with this one or you may not find the landing you hoped for!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
|
Don't stare at that too long!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
They will always be your downfall.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
|
I would trust them, they've always seemed fairly down to earth to me.
|
|
|
|
|
I'm surprised that this thread stayed straight, and did not spiral out of control.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
but they are down with that. On occasion.
To err is human to really elephant it up you need a computer
|
|
|
|
|
Apparently they outlawed stairs and police are taking steps.
|
|
|
|
|
Yes, you should. I'll explain ladder.
I've had my ups and downs lately.
|
|
|
|
|
So, after a lifetime developing software in all the variations of the C language, and for the last year in Java (specifically JavaFX), I decided that it's time to master the art of developing apps for Android mobile devices.
I bought the Kindle version of "Android Studio 4.2 Development Essentials". I found it to be an excellent starting point as it describes in detail how to configure both your Windows system and your Android phone so that you can write and transfer apps to your phone.
At one point you must convert the phone so it will accept transfers in debug mode from your computer. The moment I did this, the phone declared:
"Congratulations! You are a developer now!"
At last, after 45 years in the business, I am at last a developer!
Get me coffee and no one gets hurt!
modified 2-Jul-21 17:40pm.
|
|
|
|
|
Quest for Glory VI: So you want to be a Developer
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Congrats
The less you need, the more you have.
Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?
JaxCoder.com
|
|
|
|
|
Have you tried enabling that option again? The ensuing message is equally amusing.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Cp-Coder wrote: "Congratulations! You are a developer now!"
you should at least get a T-Shirt or a bumper sticker stating such.
|
|
|
|
|
i remember doing a small app for uiq3 just for fun...need to do this for android so I too will now be a developer amen.
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
Congratulations!
If I only had known that before...
Just tapping the Build Number 7 times
instead of wasting my time with learning, reading documentation, developing etc.
|
|
|
|
|
Did that and all I got was "Developer mode now enabled".
It clearly knew who I was!
|
|
|
|