|
Brent Jenkins wrote: Your method should really focus on what it's supposed to be doing, not extraneous tasks. Checking if it's going to plunge to a horrible and toothy death is very well part of its responsibility. Adding classes on classes on classes for a couple of operations that strongly depend on what the method is about to do on data* is a good way to create OOP spaghetti code. Been there done that got the t-shirt and I'm still maintaining that frigging mess, whose debug caused me a lot of lost hair and temper.
* I may have a parameter that should be != 0 but to the current method it does not matter, or on the other hand each other method would accept a != 0 but he needs it to be strictly > threshold. Adding a validator class and method for its conditions only is overkill. Just check them and go on. Also it help to contextualize logging and debugging wherever reflection is not an option.
CALL APOGEE, SAY AARDWOLF
GCS 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--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
"Go ahead, make my day"
|
|
|
|
|
den2k88 wrote: I may have a parameter that should be != 0 but to the current method it does not matter, or on the other hand each other method would accept a != 0 but he needs it to be strictly > threshold.
Sounds like an inconsistent architecture to me, but whatever works for you is fine
Ah, I see you have the machine that goes ping. This is my favorite. You see we lease it back from the company we sold it to and that way it comes under the monthly current budget and not the capital account.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
I skipped a detail, sorry: I'm mixing private methods with public ones. For public methods a validator or similar construct is the cleanest solution. What I said before, if applied to interface methods, would be inconsistent at best!
CALL APOGEE, SAY AARDWOLF
GCS 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--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
"Go ahead, make my day"
|
|
|
|
|
For me it comes down to how many times I'm writing the same code.
If it's more than once, then it should probably be in a method in a class of it's own unless it's complete unavoidable because of the limitations of the language/framework. To me, that's SOP for OOP code.
Ah, I see you have the machine that goes ping. This is my favorite. You see we lease it back from the company we sold it to and that way it comes under the monthly current budget and not the capital account.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Thanks for the link, Brent; looks like a valuable resource.
cheers, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
Just use lots of GOTOs, to go to the end of the function.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Sometimes, when code gets too nested and adding a nest causes me pain, I actually consider that.
CALL APOGEE, SAY AARDWOLF
GCS 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--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
"Go ahead, make my day"
|
|
|
|
|
I do parameter validation at the top of a method and throw exceptions if necessary. After that, one exit to rule them all.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Ah that could be a solution but I can't throw exceptions in my code as we use Win32 APIs so we're stich with SEH and then we have a master controller in VB6, so return codes are the best solution, also most of the code is 10-15 years old written by a chemist turned programmer.
Also I came to respect the return-value based flow control as most of the times in the fields I work on is the most reasonable way to proceed. Of course on a strictly OOP environment exceptions make the rule!
CALL APOGEE, SAY AARDWOLF
GCS 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--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
"Go ahead, make my day"
|
|
|
|
|
|
My daughter bought a photo, taken by one of those critical-moment-snap-on-rollercoaster cameras, where everyone in the cars fore and aft is screaming, and I'm gazing off nonchalantly to my left as if nothing interesting is happening.
That's pretty much normal, for me. If there's no real danger, what is there to be afraid of?
My daughter is screaming in the picture, too. Must be her mother's bad genes.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Mark_Wallace wrote: If there's no real danger, what is there to be afraid of? Someone with bad genes might puke all over you... That's my biggest concern in rollercoasters
|
|
|
|
|
OK, That I could be scared of!
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Mark_Wallace wrote: If there's no real danger, what is there to be afraid of? I present to you, real danger[^].
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill
America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde
Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin
|
|
|
|
|
Nah, taking a shower is riskier.
This[^], on the other hand...
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
A little while back I went to a theme park with she-who-must-be-obeyed. It was a little tame so we sauntered about. Stopped for lunch and then decided to do the rollercoaster.
Big, big, big mistake. I came off green: how I held my lunch down I have no idea. Moral of that tale: wait till after to eat!
Still, it was fun... until the after the first drop...
|
|
|
|
|
One funfair thing I did enjoy was a simple tower-thingy, that just shoots you straight up in the air, then drops you down again -- it's probably less than 1.5G on the way up, but it made me smile.
Nutter for linear acceleration, me.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
R. Giskard Reventlov wrote: or you come off and go green
I start going green before stepping on one of those contraptions invented by the devil.
Marc
|
|
|
|
|
Not just no but hell no!
New version: WinHeist Version 2.2.2 Beta I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!
|
|
|
|
|
I looooove rollercoasters............the bigger and faster the better
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
Looks like fun!
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
I've been asked to recommend an online donation portal for the charity that I work for. They want to encourage Peer to Peer fundraising as well as having the ability to donate to the head office directly. I've just begun my investigation and am finding a huge number of options with all levels of options, quality and pricing.
Does anyone out there have experience in this area? Any recommendations? Any help or direction would be greatly appreciated.
Many thanks.
Outside of a dog, a book is a man's best friend; inside of a dog, it's too dark to read. -- Groucho Marx
|
|
|
|
|
GoFundme is the one I see most usually.
(Type it carefully )
|
|
|
|
|
Many thanks.
Outside of a dog, a book is a man's best friend; inside of a dog, it's too dark to read. -- Groucho Marx
|
|
|
|
|
Mae sinc yn yr ystafell ymolchi i olchi eich dwylo - beidio â llenwi balwnau.
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 are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|