Click here to Skip to main content
15,913,941 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: WriteOnly Pin
Luc Pattyn18-Apr-08 4:53
sitebuilderLuc Pattyn18-Apr-08 4:53 
GeneralRe: WriteOnly Pin
Dave Kreskowiak18-Apr-08 10:24
mveDave Kreskowiak18-Apr-08 10:24 
GeneralRe: WriteOnly Pin
Luc Pattyn18-Apr-08 10:53
sitebuilderLuc Pattyn18-Apr-08 10:53 
GeneralRe: WriteOnly Pin
CPallini18-Apr-08 1:37
mveCPallini18-Apr-08 1:37 
GeneralRe: WriteOnly Pin
The Cake of Deceit18-Apr-08 0:08
The Cake of Deceit18-Apr-08 0:08 
GeneralRe: WriteOnly Pin
The Cake of Deceit18-Apr-08 2:38
The Cake of Deceit18-Apr-08 2:38 
GeneralRe: WriteOnly Pin
Vasudevan Deepak Kumar18-Apr-08 2:10
Vasudevan Deepak Kumar18-Apr-08 2:10 
GeneralRe: WriteOnly Pin
Dr.Walt Fair, PE18-Apr-08 9:50
professionalDr.Walt Fair, PE18-Apr-08 9:50 
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

GeneralRe: WriteOnly Pin
PIEBALDconsult18-Apr-08 10:55
mvePIEBALDconsult18-Apr-08 10:55 
GeneralRe: WriteOnly Pin
CDP180223-Apr-08 1:24
CDP180223-Apr-08 1:24 
GeneralDoes this count? Pin
jamie5505-Apr-08 4:20
jamie5505-Apr-08 4:20 
JokeRe: Does this count? Pin
Luc Pattyn5-Apr-08 5:03
sitebuilderLuc Pattyn5-Apr-08 5:03 
GeneralRe: Does this count? Pin
jamie5505-Apr-08 5:10
jamie5505-Apr-08 5:10 
GeneralRe: Does this count? Pin
Luc Pattyn5-Apr-08 5:28
sitebuilderLuc Pattyn5-Apr-08 5:28 
GeneralRe: Does this count? Pin
jamie5505-Apr-08 5:34
jamie5505-Apr-08 5:34 
GeneralRe: Does this count? Pin
Luc Pattyn5-Apr-08 6:08
sitebuilderLuc Pattyn5-Apr-08 6:08 
GeneralRe: Does this count? Pin
MarkB7777-Apr-08 21:18
MarkB7777-Apr-08 21:18 
GeneralRe: Does this count? Pin
zildjohn0110-Apr-08 17:04
zildjohn0110-Apr-08 17:04 
QuestionRe: Does this count? Pin
AJGermano2-Jun-08 9:57
AJGermano2-Jun-08 9:57 
GeneralRe: Does this count? Pin
PIEBALDconsult5-Apr-08 16:41
mvePIEBALDconsult5-Apr-08 16:41 
GeneralRe: Does this count? Pin
leppie5-Apr-08 20:46
leppie5-Apr-08 20:46 
GeneralRe: Does this count? Pin
Dan Neely7-Apr-08 2:30
Dan Neely7-Apr-08 2:30 
GeneralRe: Does this count? Pin
Stephen Hewitt7-Apr-08 15:35
Stephen Hewitt7-Apr-08 15:35 
GeneralRe: Does this count? Pin
PIEBALDconsult8-Apr-08 11:41
mvePIEBALDconsult8-Apr-08 11:41 
GeneralRe: Does this count? Pin
leppie9-Apr-08 0:24
leppie9-Apr-08 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.