WriteOnly
-
Uhh, no. WriteOnly only turns off the gettor of a property. A /dev/null is a completely different concept.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Who would turn off the gettor of a property? It turns them into black holes, and a /dev/null is one too.
CLR: Removes tough Java-based stains fast!
-
dan neely wrote:
It's good for smaller projects but will hammer the CPU and slow the IDE down significantly on larger projects.
Doesn't matter. Its impossible to make a large project in VB anyway: you'll go crazy from the language itself;P
"impossible" is just an opinion.
Hi all of you that think VB are such a horrible language to use for coding. I’ve notice some of you think a large project can’t be done in VB. Well, I’ve got news for you. I work for a company that develops Point of Sale software for the last 14 years, and we are currently working on a new version for the Point of Sale that has at least 2 million lines of source code in it! It is a full client-server application and can be used on a single PC and up to thousands of computers all with a breeze. Programming some parts of the application in C and other languages, VB still is the most organised and understandable code there is. Call a project with more than 2 million lines of source code small? The project contains about 121 dll’s written in VB6 and about 67 dll’s written in VB.Net. Currently we are converting all the VB6 dll’s to VB.Net dll’s. After all, it is not the language that makes an application what it is, but the programmer’s ability to develop good and reliable code, regardless of the language. ;)
A programmer's life is good... or is it?? Ek dink nie so nie!
-
Who would turn off the gettor of a property? It turns them into black holes, and a /dev/null is one too.
CLR: Removes tough Java-based stains fast!
Someone writing software to control an unbuffered output device? If there's no buffer, you can't change anything that was written out, so the getter is utterly pointless.
You know, every time I tried to win a bar-bet about being able to count to 1000 using my fingers I always got punched out when I reached 4.... -- El Corazon
-
Who would turn off the gettor of a property? It turns them into black holes, and a /dev/null is one too.
CLR: Removes tough Java-based stains fast!
Alpha Nerd wrote:
It turns them into black holes, and a /dev/null is one too.
Not quite. It turns a property into something akin to a voting box. You put your vote in, and there's no way to get it out. The class the property is defined in gets to do whatever it needs to with the data that comes in. In a "blackhole" null device, there isn't any processing allowable on the bits that end up in there...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Alpha Nerd wrote:
It turns them into black holes, and a /dev/null is one too.
Not quite. It turns a property into something akin to a voting box. You put your vote in, and there's no way to get it out. The class the property is defined in gets to do whatever it needs to with the data that comes in. In a "blackhole" null device, there isn't any processing allowable on the bits that end up in there...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008you're familiar with the software that runs in a black hole? I want you to write an article on this, that is assuming you can get it out of there.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Alpha Nerd wrote:
And if you use it, it turns your code into a coding horror.
Surely if you use it, you have a reason, and thus your code will not be a horror?
Pits fall into Chuck Norris.
There is no reason for an excuse of using that thing.
CLR: Removes tough Java-based stains fast!
-
There is no reason for an excuse of using that thing.
CLR: Removes tough Java-based stains fast!
Maybe the property is part of a quantum computer and so write only to spare the possible life of a cat.
-
Maybe the property is part of a quantum computer and so write only to spare the possible life of a cat.
Robert Surtees wrote:
Maybe the property is part of a quantum computer and so write only to spare the possible life of a cat.
You would need 9 WriteOnly properties then. Remember; they have 9 lives! LOL. :laugh: (who would build a supercomputer in VB? the language is slightly crippled, but this WriteOnly thing gives a advantage over C# or the awful C++)
CLR: Removes tough Java-based stains fast!
-
Alpha Nerd wrote:
It turns them into black holes, and a /dev/null is one too.
Not quite. It turns a property into something akin to a voting box. You put your vote in, and there's no way to get it out. The class the property is defined in gets to do whatever it needs to with the data that comes in. In a "blackhole" null device, there isn't any processing allowable on the bits that end up in there...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Unless you do this:
Public WriteOnly Property example As Object Set(ByVal value As Object) ' Do Nothing Here, Process Nothing Here End Set End Property
CLR: Removes tough Java-based stains fast!
-
But you do it manually. (and I think it complains.) CLR: Removes tough Java-based stains fast!
-
you're familiar with the software that runs in a black hole? I want you to write an article on this, that is assuming you can get it out of there.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
Yes, I have SEEN the other side! Nothing much to see, it's pretty dark...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
you're familiar with the software that runs in a black hole? I want you to write an article on this, that is assuming you can get it out of there.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
I'm familiar, hence I'm going to write few lines explaining..., but, wait, maybe I'm too close to, s**t.................................... :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Did you know VB.NET has a WriteOnly property to make properties into /dev/nulls? :wtf: It even offers IntelliSense to remove the Get accessors!
CLR: Removes tough Java-based stains fast!
It is not a surprise, given that VB itself is a horror. :rolleyes:
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
Alpha Nerd wrote:
It turns them into black holes, and a /dev/null is one too.
Not quite. It turns a property into something akin to a voting box. You put your vote in, and there's no way to get it out. The class the property is defined in gets to do whatever it needs to with the data that comes in. In a "blackhole" null device, there isn't any processing allowable on the bits that end up in there...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Dave Kreskowiak wrote:
Not quite. It turns a property into something akin to a voting box. You put your vote in, and there's no way to get it out.
But the Get accessor only returns it. Get does not remove the item.
CLR: Removes tough Java-based stains fast!
-
Yes, I have SEEN the other side! Nothing much to see, it's pretty dark...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Dave Kreskowiak wrote:
it's pretty dark...
are you sure? if it sucks everything in, and never lets go, it must be bloody light in there. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
-
Hi all of you that think VB are such a horrible language to use for coding. I’ve notice some of you think a large project can’t be done in VB. Well, I’ve got news for you. I work for a company that develops Point of Sale software for the last 14 years, and we are currently working on a new version for the Point of Sale that has at least 2 million lines of source code in it! It is a full client-server application and can be used on a single PC and up to thousands of computers all with a breeze. Programming some parts of the application in C and other languages, VB still is the most organised and understandable code there is. Call a project with more than 2 million lines of source code small? The project contains about 121 dll’s written in VB6 and about 67 dll’s written in VB.Net. Currently we are converting all the VB6 dll’s to VB.Net dll’s. After all, it is not the language that makes an application what it is, but the programmer’s ability to develop good and reliable code, regardless of the language. ;)
A programmer's life is good... or is it?? Ek dink nie so nie!
Yes, it's a good language, but I prefer C#. Besides, WriteOnly is so weirdly funny! :laugh:
CLR: Removes tough Java-based stains fast!
-
Who would use it? A coding horror in VB. And if you use it, it turns your code into a coding horror. X|
CLR: Removes tough Java-based stains fast!
Alpha Nerd wrote:
Who would use it? A coding horror in VB.
In VB? In C#, too:
class Foo { private int _val; public int Val { set { this._val = value; } } }
-
Did you know VB.NET has a WriteOnly property to make properties into /dev/nulls? :wtf: It even offers IntelliSense to remove the Get accessors!
CLR: Removes tough Java-based stains fast!
The best use for write-only things, in general, is when you are dealing with real-time control interfaces. Some devices allow you to save data to a memory location or port and that sets control bits in an external device. As far as the external device is concerned, it is an input-only deal; from the program's viewpoint it's write-only and any attempt to read would be undefined or return garbage. One logical use for a write-only property would be to control interfaces with external hardware. You would define a class encapsulating the hardware access and anything that writes to the hardware without any chance of being able to read the real-time results back, would logically be marked as WriteOnly. This is fairly common when using some PIC chips, DSP chips and assorted other devices. In my DSP applications, marking output data as WriteOnly would make perfect sense, since once it is sent to the buffer, it goes out the sound interface and does not exist anywhere that is accessible to the software. (Note: I haven't done that, since I knew it was essentially write-only and never thought I might try to read it again.) To me, marking a property as WriteOnly in a VB, C, C# or any other language very clearly tells everyone not to even bother to read it back because the data no longer exists. Another use for WriteOnly properties would be when dealing with highly asychronous processes, but I won't go into that here. So, yeah, if you're dealing with stuff in your own application's memory, WriteOnly may not make much sense, but if you are dealing with control systems and external devices, it may well make perfect sense.
The PetroNerd
Walt Fair, Jr. Comport Computing Specializing in Technical Engineering Software
-
Dave Kreskowiak wrote:
it's pretty dark...
are you sure? if it sucks everything in, and never lets go, it must be bloody light in there. :)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.
I think the light is processed into something else. I couldn't tell what though, because, like, there's no light! :-D
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
I think the light is processed into something else. I couldn't tell what though, because, like, there's no light! :-D
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Aha, I see. Or actually maybe I don't, lacking some light??
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.