Live data from Hacker News

Show HN: C++ Editor for Teaching How to Code

emun.ro

21–30 of 31 posts

Re: Show HN: C++ Editor for Teaching How to Code

#21

It fails to compile the program #include int main() { int x = 23; std::cout It seems like it can't handle namespaces. When I write #include it complains, "cannot find library: vector". I think this isn't going to be very useful for people unless you get a C++ evaluator that works correctly. There is a demo of Clang running in the browser using webassembly here: >> https://tbfleming.github.io/cib/ << but it doesn't ac…

The repo of the original interpreter: https://github.com/felixhao28/JSCPP Which notable features are not implemented yet? Goto statements Object-oriented features Namespaces Multiple files support The target audience would consists in students trying simple algorithms. By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard…

> By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard library.

if the goal is to have them writing C-style C++ code, why not just use C? or if the goal is to teach C++, why start with only the features available in C?

I've been a TA for classes in both C and C++, and I think we ultimately do a disservice to these students by not treating these languages more separately.

Re: Show HN: C++ Editor for Teaching How to Code

#22

Earlier quoted context omitted.

The repo of the original interpreter: https://github.com/felixhao28/JSCPP Which notable features are not implemented yet? Goto statements Object-oriented features Namespaces Multiple files support The target audience would consists in students trying simple algorithms. By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard…

As far as I can tell, this interpreter doesn't even have std::string, and you can't define your own datatypes or allocate. The interpreter also doesn't handle pointers into arrays properly. I'm not familiar with other countries' curricula, but we had vectors and strings very early on when I learned C++. I like the general idea of the debugging interface, that could help a lot of people. But I think you should upgrade…

These are the main downsides indeed. As a matter of fact, in the current curricula the only option is cstring, and it's been that way in the last 20 years. I am looking forward to put in balance the upsides and downsides in using such an interpreter. Thank you for feedback!

Re: Show HN: C++ Editor for Teaching How to Code

#23

Earlier quoted context omitted.

The repo of the original interpreter: https://github.com/felixhao28/JSCPP Which notable features are not implemented yet? Goto statements Object-oriented features Namespaces Multiple files support The target audience would consists in students trying simple algorithms. By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard…

> By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard library. if the goal is to have them writing C-style C++ code, why not just use C? or if the goal is to teach C++, why start with only the features available in C? I've been a TA for classes in both C and C++, and I think we ultimately do a disservice to these student…

I agree. However, the goal of the computer science classes is to teach basic algorithms and data structures, and not focusing on the language particularly. For instance, in the national exam (written) you may use any printing function (printf / cout), but you are limited to use C-style string functions. No vectors, no additional containers C++. Pointers are being studied too, but there are no exercises which involve coding in exams for memory allocations, so you never get to choose between new/malloc. I don't like this situation but this is the problem I am trying to address, any idea is well appreciated!

Re: Show HN: C++ Editor for Teaching How to Code

#25
This is the definitely the best implementation of a C++ code visualization i've seen yet, kudos to the developers for this

That said, its a bit sad that this is in C++, which I think is an atrocious language for coding beginners to learn. Sure, a lot of people here might have learned C++ to start with (me included), but there are much, much better alternatives available today (pretty much any modern interpreted language for example).

I've noticed that people who are new to coding get the biggest boost to learn more about programming if they are in an environment where they can cause some kind of interesting visual output. In this regard, many languages that have good visual tooling integration (like Javascript's integration with HTML, python integrating with a GUI toolkit like pygame) really kicks it out of the park when it comes to motivating newcomers.

If the devs are reading this, could I suggest adding a 2D graphical component to this tool? unfortunately I can't think of any good, easy-to-use graphics APIs in C++ (a la the canvas API in JavaScript), but SFML and CairoMM come to mind.

Re: Show HN: C++ Editor for Teaching How to Code

#26
post #16

If you create a variable as int and later change it to unsigned long long, it doesn't work anymore.

Yes, indeed. The live panel displays only basic types (long, char, int, floats and basic arrays). Thanks for noticing!

Great idea and implementation, btw!

Re: Show HN: C++ Editor for Teaching How to Code

#27

It fails to compile the program #include int main() { int x = 23; std::cout It seems like it can't handle namespaces. When I write #include it complains, "cannot find library: vector". I think this isn't going to be very useful for people unless you get a C++ evaluator that works correctly. There is a demo of Clang running in the browser using webassembly here: >> https://tbfleming.github.io/cib/ << but it doesn't ac…

The repo of the original interpreter: https://github.com/felixhao28/JSCPP Which notable features are not implemented yet? Goto statements Object-oriented features Namespaces Multiple files support The target audience would consists in students trying simple algorithms. By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard…

If it has no object-oriented features, then I don't think it deserves to be called a C++ interpreter at all, since that's basically the one feature everyone thinks of when they're asked to compare C and C++; from the description it looks more like a C-subset interpreter.

Re: Show HN: C++ Editor for Teaching How to Code

#28
post #8

Earlier quoted context omitted.

What about jupyter and root instead? https://root.cern.ch/notebooks/HowTos/HowTo_ROOT-Notebooks.h... AFAIK it uses clang for parsing, which is as good a C++ parser as any.

This Jupyter integration seems really cool. Since I'm targeting educational environments it would open even more options for automated evaluation. Thanks!

We have an education product and we support C++ using jupyter/nbgrader/clang too. https://datacabinet.info/dc-docs/sbs/projects.html#step-3-c . We had to make some clang changes to make it work.

Re: Show HN: C++ Editor for Teaching How to Code

#29

Earlier quoted context omitted.

The repo of the original interpreter: https://github.com/felixhao28/JSCPP Which notable features are not implemented yet? Goto statements Object-oriented features Namespaces Multiple files support The target audience would consists in students trying simple algorithms. By the end of the high school, students are only using very basic C-syntax: variables, arrays, functions, and a couple of functions from the standard…

If it has no object-oriented features, then I don't think it deserves to be called a C++ interpreter at all, since that's basically the one feature everyone thinks of when they're asked to compare C and C++; from the description it looks more like a C-subset interpreter.

From the point of end user yes, but the original JSCPP project allows custom classes and members to be available via include.

Re: Show HN: C++ Editor for Teaching How to Code

#30
This code, which is clearly undefined behavior (because of dangling pointer), outputs the number 2, which is very worrisome.

    #include 
    using namespace std;
    
    int* foo() {
        int y = 2;
        return &y;
    }
    int main() {
        int* x = foo();
        cout 
I would recommend not using this for educational purposes yet; it could mislead students about pointer usage.
Post reply on HN