What's your quickest/lightest way to try a code?
-
Quote:
emacs is a good OS, but it could really use a decent editor...
This is a good joke, but it could really use a punchline :-) (The first time I heard this joke was in '92, so I've had quiet a long time to think of a reply)
-
Yes, we got plenty of Online playgrounds. But I mean the offline ones. I've always envied Javascript devs. All they need is just a notepad and a browser and they are good to try out a logic or an algorithm. Poor guys like me used to install Visual Studio Elephant (Here Elephant points to the size don't worry) Just to try a simple code, just because I was glued to .net. Now in recent times, I use VS Code & verify the code snippets that the team does with Python. This feels quick & snappy. :-O :thumbsup:
Just use the [REPL](https://en.wikipedia.org/wiki/Read–eval–print\_loop) if the language has one, VSCode + compiler in the Code's integrated terminal if the language doesn't have one. That covers the main languages I might want to play with (Haskell, Python, OCaml, C++ or Rust in my case).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
I've always liked LINQPad - The .NET Programmer's Playground[^], ever since I heard of it anyway. It's meant for giving you a C# oriented way to query different databases, but I find it great for just trying snippets of C# code. *Not at all associated with the developer other than that we live in the same city and he gave an interesting talk a conference one time.
yeha <3 LINQPad, we got the Premium License. isnt that expensive compared to other tools or 3rd party components. And realy usefull.. I use it kinda every day, trying some simple stuff I'm not 100% sure how it works, testing some new things without creating that usual console application and .Dump() to view anything on the fly :D:D
-
Yes, we got plenty of Online playgrounds. But I mean the offline ones. I've always envied Javascript devs. All they need is just a notepad and a browser and they are good to try out a logic or an algorithm. Poor guys like me used to install Visual Studio Elephant (Here Elephant points to the size don't worry) Just to try a simple code, just because I was glued to .net. Now in recent times, I use VS Code & verify the code snippets that the team does with Python. This feels quick & snappy. :-O :thumbsup:
I am glad I am not the only one. I have a semi console app. I call it something like sortingmultidemi because the first time I used it was like 30 years ago and I was sorting a mutli dimensional array and I wanted to see the outcome. It now has more commented code than working code. but I take it everywhere. Copy Paste alot out of it. Lots of examples of things. and for some reason quicker than google when searching for something I have done before.
To err is human to really mess up you need a computer
-
I usually include a console app in my solutions called "TestHarness". That way, I can test right there in the same solution, and use all the assemblies referenced therein. For casual stuff not directly associated with a project and that doesn't need a GUI, I use a console app.
".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 -
I usually include a console app in my solutions called "TestHarness". That way, I can test right there in the same solution, and use all the assemblies referenced therein. For casual stuff not directly associated with a project and that doesn't need a GUI, I use a console app.
".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, 2013Ha, this reminds me of the HPCs I work with. When I got here, they were developing a web service API for various things. Their strategy was to deploy to test, and hit the web service, then retrieve logs from the test server and plow through them looking for errors, and/or review the results in the app that worked those kinds of data (for saving methods). Invariably, the logging wouldn't be sufficient for some problem, so they'd add more, re-deploy, etc, etc. Of course, since "branching is too hard," this also means that potentially broken code is checked in, so it could be deployed to test. These web services were part of a webapp solution. So, I put a 'Test' area in there, and built some views to let them pick the API method they wanted to run, displaying some inputs appropriate to that method, and throwing the results up on the screen. Allowed me to debug the code in VS instead of having to read logs, and test locally. These guys looked at me as if I was from the moon. Sigh.
-
yeha <3 LINQPad, we got the Premium License. isnt that expensive compared to other tools or 3rd party components. And realy usefull.. I use it kinda every day, trying some simple stuff I'm not 100% sure how it works, testing some new things without creating that usual console application and .Dump() to view anything on the fly :D:D
I vote for LinqPad also. A quick way to check out code snippets, classes and even small programs. Works with C#, F#, SQL and even VB. Similar debug methods as Visual Studio.
-
Yes, we got plenty of Online playgrounds. But I mean the offline ones. I've always envied Javascript devs. All they need is just a notepad and a browser and they are good to try out a logic or an algorithm. Poor guys like me used to install Visual Studio Elephant (Here Elephant points to the size don't worry) Just to try a simple code, just because I was glued to .net. Now in recent times, I use VS Code & verify the code snippets that the team does with Python. This feels quick & snappy. :-O :thumbsup:
I'm always working on some WPF/C# desktop app in Visual Studio - so I just create a temporary method in there, call it from a click handler etc, then delete it after I've finished validating the code.
-
Yes, we got plenty of Online playgrounds. But I mean the offline ones. I've always envied Javascript devs. All they need is just a notepad and a browser and they are good to try out a logic or an algorithm. Poor guys like me used to install Visual Studio Elephant (Here Elephant points to the size don't worry) Just to try a simple code, just because I was glued to .net. Now in recent times, I use VS Code & verify the code snippets that the team does with Python. This feels quick & snappy. :-O :thumbsup:
Set up a simple NUnit test project and just drop all of them there. But if you are testing something your team is doing I'm questioning their unit testing practices.
ed ~"Watch your thoughts; they become your words. Watch your words they become your actions. Watch your actions; they become your habits. Watch your habits; they become your character. Watch your character; it becomes your destiny." -Frank Outlaw.
-
Yes, we got plenty of Online playgrounds. But I mean the offline ones. I've always envied Javascript devs. All they need is just a notepad and a browser and they are good to try out a logic or an algorithm. Poor guys like me used to install Visual Studio Elephant (Here Elephant points to the size don't worry) Just to try a simple code, just because I was glued to .net. Now in recent times, I use VS Code & verify the code snippets that the team does with Python. This feels quick & snappy. :-O :thumbsup:
I use my imagination. Guaranteed to be compile safe.
-
Yes, we got plenty of Online playgrounds. But I mean the offline ones. I've always envied Javascript devs. All they need is just a notepad and a browser and they are good to try out a logic or an algorithm. Poor guys like me used to install Visual Studio Elephant (Here Elephant points to the size don't worry) Just to try a simple code, just because I was glued to .net. Now in recent times, I use VS Code & verify the code snippets that the team does with Python. This feels quick & snappy. :-O :thumbsup:
Depends Small bits of .net: linqpad Larger bits of .net: Rider + .net core, perhaps a unit test assembly for checking out an API or idea. For most things, I'll use the REPL: JavaScript (node or f12 in a browser), Python (ipython is friendlier than the plain interpreter, but both work), Ruby (when I used it). Rider has a c# REPL, I think.
If you say that getting the money is the most important thing You will spend your life completely wasting your time You will be doing things you don't like doing In order to go on living That is, to go on doing things you don't like doing Which is stupid. - Alan Watts https://www.youtube.com/watch?v=-gXTZM\_uPMY