Re:ASCII Art in .NET Code
by WorldMaker on Tuesday July 09, 2019 @07:58PM
(#20397993)
An interesting thing about the Timelines example is that the Reactive Extensions world uses a lot of similar ASCII drawing and often refers to them as "Marble Diagrams". There are tools to generate nice graphic versions of ASCII Marble Diagrams. Some unit tests frameworks for RX libraries even support writing tests directly as ASCII Marble Diagrams:
Re:ASCII Art in .NET Code
by selectnull on Wednesday July 10, 2019 @03:52AM
(#20399983)
Of course, whole another level of using ASCII art is to make it executable, as done by a good friend of mine: Stack Trace Art (https://github.com/ironcev/stack-trace-art).
I've loved it so much that when I saw it for the first time (some 5 years ago) I had to port it to JavaScript (original is C#) and you can see it here: https://github.com/selectnull/stacktraceart
If you're interested in story of how the idea was born, read about it in these blog posts:
Re:ASCII Art in .NET Code
by 32bitkid on Tuesday July 09, 2019 @08:14PM
(#20398085)
I have no connection or affiliation with this product, but I enjoy a good ASCII/Unicode chart in code—a picture is worth a 1k words—and I've been leaning on https://monodraw.helftone.com/ lately for my text drawing needs.
Re:ASCII Art in .NET Code
by Crinus on Wednesday July 10, 2019 @07:44AM
(#20400999)
I remember ASCII and ANSI art editors that were meant to be used with mouse ever since the DOS times (often distributed through and for BBS) in the late 80s/early 90s.
Re:ASCII Art in .NET Code
by mpoteat on Tuesday July 09, 2019 @08:24PM
(#20398133)
That's an awesome product but being Mac only is a no go for me. Electron / Web app is such a common product model, no idea why they didn't embrace that.
Re:ASCII Art in .NET Code
by userbinator on Tuesday July 09, 2019 @11:32PM
(#20398964)
Comments like this are often discouraged because they're difficult to modify when the code is changed, but in these cases it seems their purpose besides explanation is to imply that there is a good reason the code is the way it is, and that you had better have a very good reason to change the code (and the accompanying comment). In other words, they serve to also guard against change, in parts of the code which should not change often.
Re:ASCII Art in .NET Code
by ken on Wednesday July 10, 2019 @01:47AM
(#20399421)
Most of these diagrams don't look that difficult to modify -- but then, I've got Emacs (with picture-mode, artist-mode, table-mode, etc). The presence of a diagram would not discourage me from changing a function, if I thought it needed changing. I wish most functions were so well documented!
It's true I haven't seen any IDEs with similar capabilities, so I imagine it is harder for other people. At what point does it become permissible to say "It's not my problem you choose to use a text editor that isn't capable of editing this style of text"? We're certainly well beyond that point in most other areas, e.g., indentation, capitalization, or renaming.
Re:ASCII Art in .NET Code
by matthewwarren on Wednesday July 10, 2019 @07:08AM
(#20400825)
> but in these cases it seems their purpose besides explanation is to imply that there is a good reason the code is the way it is, and that you had better have a very good reason to change the code (and the accompanying comment). In other words, they serve to also guard against change, in parts of the code which should not change often.
Interesting, I'd not thought about that 'side-effect', but you're right, it does guard against that
"/\*" - literal forward slash followed by literal asterisk
"(.*?)" - followed by zero or more of any character, captured non-greedy
"\*" - and another literal asterisk
"|" - all of the above, or the following
"//(.*?)" - literal two forward slashes and another non-greedy anything
"\r?\n" - a possible carriage return followed by a newline
"|" - or
the following pattern in double quotes:
"(\\[^\n]|[^"\n])*" - a backslash followed by one character that is not a newline, OR anything that is not a double quote or a newline. this sequence can occur zero or more times, and both the matching sequence and all of the matching sequence are captured
"|" - or
"@("[^"]\*")+" - a literal at sign, followed by one or more of anything that is not double quotes, enclosed by double quotes.
All it's doing is sniffing segments that look like they might be comment blocks, sections in double quotes, and... I'm not actually sure what the last segment would be, it seems to capture @"whatever"? Regardless, this doesn't actually sniff for ASCII art as much as comments themselves.
Re:ASCII Art in .NET Code
by matthewwarren on Wednesday July 10, 2019 @07:10AM
(#20400837)
> Regardless, this doesn't actually sniff for ASCII art as much as comments themselves.
Yeah you're right. The regex just finds comments. I then wrote some very simple code that analysed the text inside the comments to find potentially interesting ASCII Art. I then looked through these manually to get the ones for the post.
https://github.com/ReactiveX/rxjs/blob/master/docs_app/conte...
I've loved it so much that when I saw it for the first time (some 5 years ago) I had to port it to JavaScript (original is C#) and you can see it here: https://github.com/selectnull/stacktraceart
If you're interested in story of how the idea was born, read about it in these blog posts:
* http://thehumbleprogrammer.com/stack-trace-art/
* http://thehumbleprogrammer.com/his-majesty-hangul-the-filler...
Are there serious interactive image editors that don't require a mouse? For symmetry's sake.
It's true I haven't seen any IDEs with similar capabilities, so I imagine it is harder for other people. At what point does it become permissible to say "It's not my problem you choose to use a text editor that isn't capable of editing this style of text"? We're certainly well beyond that point in most other areas, e.g., indentation, capitalization, or renaming.
Interesting, I'd not thought about that 'side-effect', but you're right, it does guard against that
Yeah you're right. The regex just finds comments. I then wrote some very simple code that analysed the text inside the comments to find potentially interesting ASCII Art. I then looked through these manually to get the ones for the post.