|
I can't think of a single use for a partial method either.
"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
|
|
|
|
|
When I learned about partial functions, I immediately embraced it. My project at that time was a protocol stack, with data transport, control and management planes. Each plane is a set of functions completely separated from the other two, but operating on the same protocol layer entity. Partial fuctions allowed me to keep the implementation of the planes completely independent of each other. Obviously, very plane specific functions didn't make use of partial functions, but for e.g. initialization and cleanup it was great.
Once you get going with partial functions, you add e.g. logging functions without cluttering up the plain code. When you write test functions, you write a partial function to verify entry and/or exit conditions. In the development phase, you add extensive parameter validation that would be too expensive to run in production code, or you add code for performance measurenment and statitics to detect bottlenecks and excessive resource reuqirements, so they can be fixed before the product is released.
Yes, you can put it all into one huge, messy code file with a lot of #ifdef to disable parts of the code. The programmer responsisible for one of the planes will have to wade through lots of code that is ireelevant to his tasks. An update in any of the planes, the log functions, the performance measurement functions, the test and validation functions,... invalidates the source file of every other programmer on the project.
Obviously it can be done that way. But I love the partial functions, considering that to be a much better way to do it.
|
|
|
|
|
I do not agree. We have a number of WCF/SOAP projects where we generate code from wsdl and same thing with XML generating code from XSD. I both cases it is beneficial to have additional methods or properties in a separate file. When XSD or WSDL is updated you code is not overwritten during regeneration.
|
|
|
|
|
Once again, this discussion isn't about partial classes - it's about partial METHODS.
".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
|
|
|
|
|
No Research needed. It's for extending generated Code that may will be re-generated later (so you can not change it because your changes would be overriden). E.g. I use it to extend EF generated Contexts. It's a very nice feature and .NET has many not everyone will use, so don't. But if you do Frameworks or template-code or big systems (or WindowsForms UI) it's very handy…
|
|
|
|
|
Finally, a good answer to what Partial Methods are good for.
|
|
|
|
|
Despatch with Egyptian navy by the back door (7)
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Is it SCROTUM?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Despatch POST
with Egyptian E
navy RN
by the back door
POSTERN
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yep you are in charge of Brexit up tomorrow
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Oh gawd. Does that mean you have no confidence in me then?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
It means that you are expected to resign. Your legacypoints will then be up for grabs...
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
In May's case, that's somewhat of a poisoned chalice...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I ma glad the context is clear, there are different possible interpretations of that line.
|
|
|
|
|
Is it SCROTUM?
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Yes if the clue was
Books in Project Management are balls (7)
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
The odds on that are either 0 or 1, depending on how much pkfox feels like giving MM the job tomorrow.
And only @petepjksolutionscom can tell you that!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Close
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Don't buy any more hooch at car boot sales.
Peter Wasser
"The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts." - Bertrand Russell
|
|
|
|
|
pwasser wrote: Don't buy any more hooch at car boot sales.
Then where exactly do you expect me to find my hooch? Can you get it elsewhere in W.A.?
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
I did it, I started my own guitar shop. (VMA Guitars[^])
(Harder than I thought)
It's very, very small and I'll start out with just a few guitars (and outside my usual job). I'm about to place my first order with Danelectro guitars and I was thinking about the 84 and the 59M (NOS). For the 59M (NOS) I'm still in doubt what color to take.
So what's your favorite and what would be "easiest" to sell? (Colors[^])
|
|
|
|
|
Good luck ...
|
|
|
|
|
Congratulations on setting up the shop successfully.
V. wrote: So what's your favorite
The one in white looks cool.
|
|
|
|
|
Spam!
Only kidding - I can get behind more guitar shops advertising here
Good luck with this.
This space for rent
|
|
|
|
|
Wow congratulations and good luck man!
V. wrote: So what's your favorite and what would be "easiest" to sell? (Colors[^])
That's no brainer. White is very sexy!
|
|
|
|