1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Peter Nov 21 '17 at 17:38
  • $\begingroup$ 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. $\endgroup$ – ctrl-alt-delor Nov 21 '17 at 17:42
  • $\begingroup$ 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. $\endgroup$ – Buffy Nov 21 '17 at 19:43
  • 1
    $\begingroup$ @pojo-guy we sold the tele-types last year; we now use video display terminals. I thought we should take advantage of them. see youtube.com/watch?v=8pTEmbeENF4 $\endgroup$ – ctrl-alt-delor Nov 22 '17 at 16:48
  • 1
    $\begingroup$ 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: learnprolognow.org/… ). 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. $\endgroup$ – wvxvw Nov 23 '17 at 14:27
5
$\begingroup$

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.

$\endgroup$
4
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ I am only looking for Free/Libre Software, but I will look at this to see what it offers. $\endgroup$ – ctrl-alt-delor Dec 8 '17 at 17:39
  • $\begingroup$ Ah, sorry, can't help you there. Swift itself is Apache-licensed, but Xcode is not. (If only... :( ) $\endgroup$ – SilverWolf Dec 8 '17 at 20:50
  • $\begingroup$ So do we need Xcode to run Swift? $\endgroup$ – ctrl-alt-delor Dec 9 '17 at 16:05
  • $\begingroup$ 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.) $\endgroup$ – SilverWolf Dec 10 '17 at 14:17
  • $\begingroup$ 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.) $\endgroup$ – SilverWolf Dec 10 '17 at 14:17
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Buffy Nov 21 '17 at 19:51
  • $\begingroup$ 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. $\endgroup$ – ctrl-alt-delor Nov 21 '17 at 21:56
1
$\begingroup$

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.

$\endgroup$
1
$\begingroup$
  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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – ctrl-alt-delor Dec 18 '17 at 17:22
  • $\begingroup$ 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. $\endgroup$ – TooManyCooks Dec 18 '17 at 19:55
0
$\begingroup$

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.

$\endgroup$
-1
$\begingroup$

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/

$\endgroup$
  • $\begingroup$ Can you tell us a little about it. Tell us what makes it good, in context to the question. $\endgroup$ – ctrl-alt-delor Nov 27 '17 at 18:43
  • $\begingroup$ 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? $\endgroup$ – ctrl-alt-delor Nov 27 '17 at 18:50
  • $\begingroup$ 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. $\endgroup$ – Akos Nagy Nov 27 '17 at 20:13
  • $\begingroup$ And here's the page for the installer: 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. $\endgroup$ – Akos Nagy Nov 27 '17 at 20:15
  • 1
    $\begingroup$ I will not download anything, until I first know why. What is good about Xamarin? $\endgroup$ – ctrl-alt-delor Nov 27 '17 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.