1

More interactive environments are easier to learn, but the text based ones I have seen lately don't let you change your mind.

I have used Read–Eval–Print Loop (REPL) environments. However these are not suitable, as it is not possible to edit or view code that one wrote earlier.

In [1]: a=5

In [2]: b=a/3

In [3]: b
Out[3]: 1.6666666666666667

In [4]:

they are of some value. However it becomes less useful when creating something big, when creating routines.

I want to be able to create sub-routines interactively, and then be able to inspect them, and edit them. It also needs to be easy enough for teaching beginners.

In [4]: def double(a):
   ...:     return 3*a
   ...:

In [5]: show double

    def double(a):
        return 3*a

image showing what happens when user types edit double: editable code apears

In [7]: show --all

    def double(a):
        return 3*a

    def oneMoreThan(a):
        return a+1

I am not too worried about language. I am just looking for a nice interactive learning environment, that combines the best of REPL and editing. Can you tell me of anything that you use or know of?

I will add an answer that shows what I have found, but it is not an acceptable answer as I don't think it is easy enough.

Buffy
  • 35,808
  • 10
  • 62
  • 115
ctrl-alt-delor
  • 10,635
  • 4
  • 24
  • 54
  • 1
    My gut reaction is that this is off-topic here. How does this relate directly to CS Education? If you were asking about specific pedagogical features of a programming environment, that's a different story (and similar questions have been asked). Also, it seems to me that answers to this question would depend greatly on the language of choice; as is, this is a broad list question. – Peter Nov 21 '17 at 17:38
  • I am looking for a resource, for teaching programming. It needs to reduce barriers to learning. The feature I mention in the question would reduce barriers. More interactive environments are easier to learn, but the text based ones I have seen lately don't let you change your mind. – ctrl-alt-delor Nov 21 '17 at 17:42
  • You seem to want to retain the features of REPL but also have a full featured development environment. I don't understand why that has to be the same program. Why not use one of each for their strengths? Certainly if you do something interesting in, say, Idle, you can copy and paste it into a full environment with file management, compilation, execution, etc. – Buffy Nov 21 '17 at 19:43
  • @Buffy That is what I do, but this morning when I woke up, I had this idea that we can have both. And that it would be of grate value in teaching. – ctrl-alt-delor Nov 21 '17 at 21:45
  • Jupyter notebooks (formally known as IPython notebooks) springs to mind, but given you posted an answer using IPython, I'm assuming you're already familiar with these? If not, if you already have jupyter installed, it's as easy as running `jupyter notebook` from the command line (or, if you're using an older version of the program back when it was called IPython, run `ipython notebook`). – Michael0x2a Nov 21 '17 at 21:48
  • @Michael0x2a no. I know nothing, what I put in my answer is from some research I did today. So please put an answer for me and anyone else. – ctrl-alt-delor Nov 21 '17 at 21:59
  • Have you looked at scratch? I just stayed my son on it and he's enjoying it immensely. – pojo-guy Nov 22 '17 at 04:40
  • @pojo-guy I am looking for text based. I do teach scratch already. – ctrl-alt-delor Nov 22 '17 at 06:32
  • Why not just go to any IDE and"real" projects then? I initially learned BASIC on a teletype, so an IDE after some beginnings in Scratch seems like a huge improvement. – pojo-guy Nov 22 '17 at 12:44
  • 1
    @pojo-guy we sold the tele-types last year; we now use video display terminals. I thought we should take advantage of them. see https://www.youtube.com/watch?v=8pTEmbeENF4 – ctrl-alt-delor Nov 22 '17 at 16:48
  • 1
    With Prolog you can always inspect the source code using `listings/1` or `listings/0` predicates. You can also modify them using `assert` / `retract` (more info here: http://www.learnprolognow.org/lpnpage.php?pagetype=html&pageid=lpn-htmlse48 ). I'm using Prolog (SWI) from Emacs, but there must be other editors, perhaps less scary to beginners. SWI also has `qsave_program/2` to save program image, but I don't think it's ISO Prolog. Lisps typically offer the same, but some source code entered interactively may be actually lost. – wvxvw Nov 23 '17 at 14:27
  • I see you are experimenting with Runestone Academy. It looks like you asked a question from the site but did you know that those questions are turned into GitHub [issues](https://github.com/RunestoneInteractive/RunestoneComponents/issues)? e.g. your question [Add a book of my own to your server](https://github.com/RunestoneInteractive/RunestoneComponents/issues/522) – Guy Coder Dec 29 '17 at 12:05

7 Answers7

5

I am not too worried about language. I am just looking for a nice interactive learning environment, that combines the best of REPL and editing. Can you tell me of anything that you use or know of?

Runestone Academy has a component called ActiveCode that allows you write Python code and run it. It also has a slider so that you can go back to earlier versions of your source code to review and run.

In addition to activecode, you can also execute Python code with the assistance of a unique visualization tool. This tool, known as codelens, allows you to control the step by step execution of a program. It also lets you see the values of all variables as they are created and modified.

There is a lot more to the web site but is what I use to help others learn Python 3 and the nicest part is that once the students get the hang of the e-books they tend to take off at their own pace.

Guy Coder
  • 934
  • 1
  • 6
  • 10
4

Expanding on hotpaw2's answer:

If you have a Mac, you can use Swift Playgrounds in Xcode.

It allows you to type code and see the results immediately, like this:

Swift Playgrounds Example

It only supports Swift, Apple's new language for making Mac and iOS applications. You can find out more about it over here. It's a good language for small things like learning programming, but it scales up to entire applications.

This all comes with Xcode, which you can download for free from the App Store.

SilverWolf
  • 143
  • 5
  • I am only looking for Free/Libre Software, but I will look at this to see what it offers. – ctrl-alt-delor Dec 08 '17 at 17:39
  • Ah, sorry, can't help you there. Swift itself is Apache-licensed, but Xcode is not. (If only... :( ) – SilverWolf Dec 08 '17 at 20:50
  • So do we need Xcode to run Swift? – ctrl-alt-delor Dec 09 '17 at 16:05
  • No, you don't. You need Xcode to run the playgrounds or build Mac/iOS apps, but Swift itself will work just fine without it--even on Linux! (You can still use a REPL or compile it into an executable.) – SilverWolf Dec 10 '17 at 14:17
  • Note that on Mac, you're better off getting Xcode anyway, as it comes with the compiler, etc. (If you try to run clang/gcc without it, it'll prompt you to install the Command Line Tools, which contains the compiler, etc. but not the Xcode GUI.) – SilverWolf Dec 10 '17 at 14:17
  • Also, on Linux, it will have most but not all of the Foundation API, as the Objective-C runtime is not part of the open-source project. (So `String` but no `NSString`, for example.) – SilverWolf Dec 10 '17 at 15:15
2

In addition to Racket, check out drjava for Java and drpython for Python.

For Python you can also check out Thonny.

All have a repl section and a code section. Write your definitions in the code section and interact in the repl section.

Emacs can also be configured this way for a whole host of languages.

Mike Zamansky
  • 1,572
  • 6
  • 11
1

DrRacket combines a coding window with a REPL environment. It would mean moving out of the imperative paradigm into a functional one, but the setup is really quite nice:

enter image description here

The top window is called the Definitions Window, and the bottom is called the Interactions Window. Work in the bottom window for as long as you like, but once you have something built up, copy the all-important function definition into the top.

Be warned that when you press the run button, the interactions window is cleared. However, you can now freely utilize any functions that have been defined in the top area.

Ben I.
  • 32,726
  • 11
  • 68
  • 151
  • Since Java has recently added REPL support to the language, I suspect that Eclipse and others will soon have support. That is remarkable for a language like Java, actually. – Buffy Nov 21 '17 at 19:51
  • Will give it a look. As I said I don't care about language. As long as I don't loose something more valuable. However what I rely would like is some way to move `number-checker` from the bottom window to the top, not by pasting, but by asking it to move (e.g. `(show (number-checker))` or `(clip (number-checker))` to put into clip-board. – ctrl-alt-delor Nov 21 '17 at 21:56
1
  1. Repl.it REPL.itsupports several languages. It also supports manual and automatic testing (unit tests). When students complete task they can see instructor model solution.

  2. Google currently supports Jupyter Notebooks https://colab.research.google.com which would allow you some pedagogical tools in terms of embedding code within explanations.

TooManyCooks
  • 123
  • 5
  • This answer is very short. It is of little use as it tells me nothing about the ..... (word left blank, because I know so little that I can not fill it in). There is also no link for the first, so I can not even look it up. – ctrl-alt-delor Dec 18 '17 at 17:22
  • I'm so used to the fact that repl.it is the name of the product and the url that I forget to link when discussing. Since the topic is "interactive programming environment" I misjudged that the products listed would be interpreted as such. I will agree that it should be further edited to indicate that these products do address the features and usability requested in the original post. – TooManyCooks Dec 18 '17 at 19:55
0

What I have found so far. I don't think this is suitable for teaching a class of beginners, as it is too complex.

In ipython, you can display the code of a function/procedure, variable…, by typing its name followed by two ?.

In [10]: double??
Signature: double(a)
Source:
def double(a):
    return a*2
File:      ~/<ipython-input-8-4a40aa4fc91f>
Type:      function

In [11]: a=5

In [12]: a??
Type:        int
String form: 5

In [13]: %ed double

Now the terminal switches to an editor, when I quit the editor the new definition is invoked, and I return to repl mode.

ctrl-alt-delor
  • 10,635
  • 4
  • 24
  • 54
-1

I can wholeheartedly suggest Xamarin Workbooks: https://developer.xamarin.com/guides/cross-platform/workbooks/

Awesome, nice UI. You can use it for more than Xamarin, if you are teaching any .NET based class, it is a very valuable tool. There are a couple of sample workbooks avaialable here: https://developer.xamarin.com/guides/cross-platform/workbooks/samples/

And the best part is that you can extend it yourself, if you know a little typescript. I've created one a while back to demonstrate how Entity Framework Code First creates the database tables from the defined source code. You can check it out here, if you are interested: http://dotnetfalcon.com/net-workbooks-entity-framework-model-explorer/

Akos Nagy
  • 119
  • 3
  • Can you tell us a little about it. Tell us what makes it good, in context to the question. – ctrl-alt-delor Nov 27 '17 at 18:43
  • I have looked at their website, and found out nothing about it. I feel like they are trying to herd me toward the pay wall. I just found a link “Tell me more about Xamerin“, it takes to to a page with little info, and a big download button, this button takes me to a sign up page. They need to get their marketing in gear, who would buy something that they can not find out what it is? – ctrl-alt-delor Nov 27 '17 at 18:50
  • I like the nice UI and the extensiblity, as stated in my answer. I also gave an example of how I extended it, but I see other useful ways (e.g. when teaching OO, you can extend it to draw the class diagram at the end). You can also edit the code "on-the-fly" and rerun it, as required by OP. – Akos Nagy Nov 27 '17 at 20:13
  • And here's the page for the installer: https://developer.xamarin.com/guides/cross-platform/workbooks/install/ Just click on the second option and you can download it. Btw. Xamarin is part of any edition of Visual Studio, the Community Edition also, which is for free. – Akos Nagy Nov 27 '17 at 20:15
  • 1
    I will not download anything, until I first know why. What is good about Xamarin? – ctrl-alt-delor Nov 27 '17 at 20:20
  • You can use it for more than just Xamarin, as stated in the comments. It's just that the team inside Microsoft that published this tool is the team responsible for Xamarin. You can use it for plain old C# (that's how I use it). – Akos Nagy Nov 29 '17 at 09:36