|
(I broach this subject here because I don't think there's an answer. Note the "rant" icon.)
Consider:
ObsoleteAttribute -- Marks the program elements that are no longer in use.
What would be the opposite/complement? A way to mark some code as not-yet-ready-for-primetime?
Not to the extent of throwing a NotImplementedException , because the code exists and works (mostly).
Not a todo either; that's too passive.
But, if I have a kludgey Method I intend to rework at some convenient future time, I want to be reminded about it every time I compile code which calls it. Even if the Method has been compiled into a DLL.
An ObsoleteAttribute will do this -- but I expect that it would be confusing to my colleagues.
Even a UseAtYourOwnRiskAttribute would be better.
|
|
|
|
|
PIEBALDconsult wrote: A way to mark some code as not-yet-ready-for-primetime?
[UnderDevelopment]
[Future]
[ComingSoon]
PIEBALDconsult wrote: But, if I have a kludgey Method I intend to rework at some convenient future time, I want to be reminded about it every time I compile code which calls it.
[Sh*ttyCodeAhead] (self-sensored that, lol)
[KludgeyCode]
|
|
|
|
|
Marc Clifton wrote: [UnderDevelopment]
[Future]
[ComingSoon]
[BetaQuality], and presumably [AlphaQuality].
Not a .Net developer, but it looks like you can create your own Attributes: Writing Custom Attributes | Microsoft Docs, so maybe actually doable?
Keep Calm and Carry On
|
|
|
|
|
Could work if they allowed deriving from ObsoleteAttribute . But. They. Don't. 
|
|
|
|
|
For probably good reason. [^]
Also that article is a solid introduction 
|
|
|
|
|
Idea:
what about a Custom Codeanalyser NuGet-Packet, witch contains the Attributes and does the Messages for them.
but might be a little overkill 
|
|
|
|
|
[Incomplete]
[LitelyTested]
[CutAndPasteAtYourOwnRisk]
[CodeProjectQAQuality]
[hmmmmNotSureAboutThis]
[YouFeelLucky]
|
|
|
|
|
You forgot some important things.
[DontTouchOrTheBossWillRipYourHeadOff]
[UnmaintainableButLightningFast]
or simply
[ThisIsDeliberate]
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Here there (may) be dragons.
|
|
|
|
|
Mike Hankey wrote: [CodeProjectQAQuality] Surely, nobody here produces SUCH bad code?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
#define, #if and some imagination.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I'm going to be the heretic here, and claim the "kludgey" code should not be in the public repository of your library. It should either work properly, or be kept in your private repository until it can be fixed.
To give examples from other engineering fields, would you tolerate a building code which deems it acceptable that a building will collapse approximately 1 in a million times that you lock the front door? would you tolerate electronics that burst into flame approximately 1 in a billion times you switch them on? So why should your clients be expected to tolerate "kludgey" code?
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
|
How about a SinisterHackAttribute for makeshift code that still needs attention? Don't beat around the bush and use a name that says exactly what's going on. And you might also need the TheBossWillKillYouIfYouMessWithThisCodeAttribute.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
MarkedForImprovement
ToBeReworked
NotFinalYet
FutureOptimization
IncomingChanges
...
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Consider
#warning This code is dodgy, I was sober when I wrote it
public void Kludge()
{
}
Warning in your output every time you build
veni bibi saltavi
|
|
|
|
|
So, an OutOfGinAtribute()
|
|
|
|
|
Even when it is referred to by other code?
|
|
|
|
|
PIEBALDconsult wrote: not-yet-ready-for-primetime
Seems to be a natural state for all the code in the world. The opposite ReadyForPrimetimeAttribute or just WorkingAttribute belongs to science fiction.
|
|
|
|
|
PIEBALDconsult wrote: But, if I have a kludgey Method I intend to rework at some convenient future time, I want to be reminded about it every time I compile code which calls it.
OMG. No.
Is there ever any code you don't intend to rework?
Over time my code would evolve into endless warnings every time I compiled it. Until I turn it off, making it completely pointless.
|
|
|
|
|
Sure, yet some are worse than others, or at least some times I know what I want to do when I have the time.
|
|
|
|
|
I use #warning directives in my C# for this. Their messages show in every compile including product builds, so I can't forget things that need to be reviewed. It's nagging without being obstructive.
Software Zen: delete this;
|
|
|
|
|
Even when referencing something in a DLL?
|
|
|
|
|
For developing at my desk, the warning message is only issued when compiling the DLL, obviously. Our automated build process builds all parts of the product from source which causes the warnings to be in the build log. Both results are sufficient to help me keep track of items for later changes.
The exceptions to both of these cases are third-party libraries supplied without source code. We use several of those to control hardware we buy off-the-shelf.
Software Zen: delete this;
|
|
|
|
|
What do you guys think for these containers? After using them for a while with VS, I think this technology is a rubbish. Too many moving parts. Versioning nightmare. URLs changing, living you high and dry, conflicts between solution and projects etc.
Is it just me who is not fully appreciate/understand this library management mechanic?
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
modified 3-Mar-21 14:58pm.
|
|
|
|