Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: A simple GUI Notepad using C++ natively made in my high school in 2015 (github.com)
87 points by mindfreeze 28 days ago | hide | past | favorite | 72 comments

No matter what language type of C++ he is using, I find this an amazing achievement for a high schooler.

I didn't write my first line of code until I was 20 years old in college, and 8 years later I am now a lead developer at one of my country's largest telecommunications companies.

I can't imagine how amazing this guy is going to become being able to build this at such a young age. Keep it up!

I started coding at 8 and didnt turn up nothing special. The only difference between me and my peers is that i earn 5x more but that doesnt mean much, probably just lucky.

There's lots of kids as young as like 12 out there on the internet programming complex projects all on their own.

Granted, it is amateurish code for amateurish projects, but the users don't care and gladly eat it up.

This is mostly related to video games by the way, so mods, cheats, helper programs, bots you name it and the person creating them is often a kid.

Building a text editor is fun. It's the ultimate scratch your own itch project.

I remember building one back in the day (2002) with Visual Basic 6.

Unfortunately I lost the source code but I still have the website's code. Feature wise it had syntax highlighting, column selection, project wide find / replace, file edit history (timeline), multiple clipboards, splits and more.

Does anyone remember what that really good text editor control was in VB6? It did most of the heavy lifting. It wasn't a built-in control.

That sounds like CodeMax, or its descendent CodeSense.

CodeMax was originally a product by Barry Allyn (WinMain software) and it was pretty good.

Unfortunately though for him the market was pretty small and it was difficult to survive as a commercial product. It was open source for a short while and that was when CodeSense came about.

Hmm, it definitely wasn't CodeMax but CodeSense rings a bell, but I'm only about 10% sure it was CodeSense.

I think I would immediately know the name if it were mentioned. It was much faster and better than anything at the time when it came out.

Rich text box?

Nope, it was a third party control. I believe it was originally written in C but someone wrapped a VB6 control around it.

It was something you could drop into your app and it had an API for all sorts of nice features. It was one of the best controls at the time for creating a text editor.

If you like stories about kids going way above and beyond in programming, read about Raymond Lau and Stuffit.


Shouldn’t the title of this have a “Show HN: “ prepended?

Updated, Thanks


>> I would now love to opensource the project for everyone.

Where is the license?

Learn more about licensing here: https://help.github.com/en/articles/licensing-a-repository

I dont know what age range high school encompasses where you are, but assuming its similar to the Uk thats a mighty achivement, especially considering your frank recognition of the bugz

OP appears to be from India.

I've interacted with several HS graduates from India, and those who opt for CS in HS (11th and 12th grade; usually ages 16-17) are usually taught C++ in Turbo C++ 3.0. This release of Turbo C++ was released in 1990.

That's... not great. For reference, the C++ programming language was first standardized in 1998.

Thus, most graduates never learn proper C++ in the sense that a lot of what they're taught doesn't even compile on modern compilers and they aren't aware of many new* features.

That said, this project is still pretty impressive for an HS student, even if it's written in ancient C++ and requires DOS to run :)

*new = anything introduced to C++ in the last three decades (after 1991).

However, apparently they've introduced Python3 last year, so hopefully the situation will improve :)


It was taught in Turbo C++, Syllabus was very basic ones which has basic i/o, file stream, loops, etc.

So at that time, wanted to explore something out of box, and for the 12th Grade Project, School did restrict to only Turbo C++ at that time, so the thing which was most possible solution was to hack around with that and having a mouse pointer and a GUI was a pinnacle moment at that time when the resources was limited.

But now School's Board of Examination (CBSE) did change syllabus to Python did move to Python scraping C++.

I see nothing wrong in learning progaming using old tools. The key thing is to deliver the basic concepts required for problem solving. In all honesty a student can learn "proper" C++ at a later stage.

> This release of Turbo C++ was released in 1990.. That said, this project is still pretty impressive for an HS student, even if it's written in ancient C++ and requires DOS to run :)

I agree it's unfortunate that schools are/were slow in catching up to a modern programming environment. This highschooler's project was made in 2015, so the students were learning a language standard/platform that was a couple decades behind.

It makes the project even more impressive, given the technical constraints that the student had to work with, in addition to their young age.

It's a good example of the "hacker" spirit that we encourage on HN. Software (and hardware I imagine) engineers deal with similar situations often, having to work around the limitations of legacy codebases or platforms, challenging what it can be made to do.

Another comment mentioned that some schools moved to teach PHP instead of C++. Granted that's an improvement in some aspects to Turbo C++ 3.0, I think the latter might have been better in terms of learning the real fundamentals.

We were taught programming in high school in QBasic (2005-2006). It was fun and we learned a lot. I don't think it matters how old the language is.

I've been spittings hundreds of c++ code back in 1996-1999, not knowing that it was not...standardized. You may be astonished at the complexity. The only downside was that it took minutes to compile it on 386DX and Borland's C compiler was faster with C. Inline assembly was a commonplace back in the day, so to know C/C++ actually meant to know Assembly and hand-optimize code more often than not.

I've worked with plenty of complex legacy C/C++ :).

The downsides are that it doesn't run on modern machines, is difficult to maintain, and you need to implement dozens of workarounds to do basic things that can be done in modern languages with just a couple lines of code.

I think the C++ version shouldn't matter that much. High School is for getting people hooked on programming. I learned Borland Delphi in High School and a bit of PHP and C. I later studied CS where these languages were mostly irrelevant, but nevertheless it was a good foundation for learning other languages.

C++ is not the language I'd use to get many people attracted, but if that is the only language the teacher is able to teach, it's better than nothing.

Also: Modern languages tend to have a lot of features that will put people off, because it's too much to learn in class probably at 2 hours per week.

I learned C at 14 to 15 from a compiler tutorial. I did however, learn C++ from reading the C++faqs in college and today, years later I still mostly don't get internals in C++ (I don't really understand move semantics but from what I understand the compiler does a better job than me). C++ is a ballooning language and really mastering the thing seems impossible if you have a day job that doesn't involve mastering it.

In Poland we had c++ as part of the curriculum around the ages 16-19. Granted, all projects were just simple algorithms, like for sorting digits and finding the shortest paths, but still.

Same in sweden some time ago around 2007. I wonder why they didn't picked like C, BASIC or Pascal or something. C++ feels very unforgiving as a starter language.

10 years later when I worked as a substitute teacher it was PHP instead which felt more odd as a starting general programming language ...

In my CSYS Computing Course in high school in the UK we used C.

It was very very basic stuff though.

Still, I was able to basically walk through my first year at Uni (which was exclusively C programming) with almost zero effort.

Mine's not as cool but I did a similar project using Qt and C++:


I wanted to make a cross platform text editor that was simple and consistent throughout different platforms. I found it easier to do it in Delphi cause I wasn't sure how to hook up a syntax highlighter for it. I'm proud of the small bits I did code though. C++ isn't really my strongest language.

The function declarations are formatted in such a way that it makes you think the prototypes come after.

Solid project, but I suggest you run the file through something like clang-format.

I don't care how many bugs it's got. The fact you've done something that isn't 700MB Electron app gets my upvote. Great work!

Simple thinking is frowned upon nowadays.

What school was it? :) Maybe you could share the curriculum/syllabus of coding classes in that school? Thanks!

It is Kendriya Vidyalaya[1], chain of Central Government Schools in India, so they have almost one school in almost in a district of a state. or sometimes two or three in the state depending on Population Density.

So at that time Syllabus is something like this[2], it is not exactly same, almost same and I think this was overall pattern of that[2], now it is again revamped[3].

At our time it was more like 4 hours theory/week and 1.5/2 hours lab sessions(which sometimes becomes theory).

[1]: https://en.wikipedia.org/wiki/Kendriya_Vidyalaya

[2]: https://www.kv1bhuj.org/admin/downloads/1997118251study_mate...

[3]: http://cbseacademic.nic.in/web_material/Curriculum19/Main-Se...


This appears to be for DOS, and I'm betting this was written in Turbo C++. From what I've heard from my friends, almost all schools in India still use Turbo C++ (in DosBox) to teach C++. Ew.

36 year old me is very glad to have learned VGA graphics programming with Turbo Pascal and Turbo C++ during high school. I've met kids these days coming out of university CS degrees in the U.S.A. that still don't have a solid grasp on how pointers work.

I believe it is in every programmer's interest to have a deep understanding of the system for which they are working on, even if they don't need to use the low level tools from day to day. Teaching C++ in DOS can still provide an excellent CS foundation IMO.

I would even argue it is much better than trying to do so on a more modern system, as you directly can just use graphics and color (which is both fun and helps teach a lot of programming concepts that are useful to know for building UIs later) without wasting a ton of time learning some UI toolkit that will be neither instructive nor actually-useful in the real world (as even if you choose a good one, it is almost certainly going to be obsolete by the time you go to get a job).

Here is a nice quick tutorial on using the frame buffer in Linux: https://cmcenroe.me/2018/01/30/fbclock.html

Raw pointers in C++ are an introductory concept at this point.

You also have l-value references, r-value references, smart pointers (unique, weak, shared, etc), and many of those have a use-case that overlaps with raw pointers.

As far as pure UX is concerned, Turbo Pascal and Turbo C++ are still a gold standard of text-mode IDE's.

Emacs has tried to add a bit of the same featureset lately, like it will show a primitive TUI menubar if you launch it from a terminal but it's quite half-baked; the look and feel is sub-standard, and mouse interaction (via gpm or xterm) doesn't actually work by default. (Of course I realize that capturing mouse events is not always desired but it should be reasonably easy to allow this, maybe even as a default.) And it still lacks other basic UX elements like floating windows for dialog boxes, or resizing/rearranging windows with the mouse.

FreePascal still ships a proper TUI IDE, and there's a FreeDOS text-mode IDE for C/C++ known as RHIDE.

Instead of displaying disgust, why not try to say something uplifting instead? Constraints like using a limited environment can do wonders for people’s creativity.

> Constraints like using a limited environment can do wonders for people’s creativity

The problem is that the teachers (and the students by extension) don't know that they are learning helpessly outdated things. Nothing would be lost if they were instead learning today's coding styles & paradigms and they could be actually much more creative by using modern practices where the compiler can infer a lot instead of trying to fight with older compilers and doing that: https://github.com/vibhoothiiaanand/CNotepad/blob/dlevel/CNo...

How many security issues will be caused because that student hasn't been taught about global variable issues, std::string, etc... ? I'm not hopeful.

If you want to be "creative", you can do the same thing than this: https://github.com/vibhoothiiaanand/CNotepad/blob/dlevel/CNo... but in much prettier, portable, useful and much less lines of code with e.g. OpenFrameworks: https://openframeworks.cc/ofBook/chapters/lines.html - and at least the tutorial gives you an idea of non-one-letter variable names.

Dear student: please send that to your teachers please : https://github.com/jcelerier/cpp-teaching-manifesto

I agree with what you have said,

Open framework surely looks promising, so do the manifesto,

At that point, I think I was mostly self-driven with the goal of making "it works" with little to no knowledge of security aspects of things. If I am doing the same thing now I would be knowing how to do, how to "Google", and also the right place to ask, but at that time I think I wasn't aware, I do also think this or even worse is the situation of school students at least here because there is no exposure to things and the bright side of the Internet.

Also, for this to solve, one thing we can do is start FOSS and cybersecurity Clubs and build a culture among them through various ways like competitions, workshops, code-sprints, hackathons, CTFs and lot more which can be solved. Keeping that in mind, from our uni we have Started CTF competitions and bootstrapping them through workshops,


So last year(2019), we did try to have workshops and courses, classes online and offline for school students which did help them.

So the primary problem here I faced was lack of understanding of how really things work and how to explore in a better way.

> At that point, I think I was mostly self-driven with the goal of making "it works" with little to no knowledge of security aspects of things. If I am doing the same thing now I would be knowing how to do, how to "Google", and also the right place to ask, but at that time I think I wasn't aware, I do also think this or even worse is the situation of school students at least here because there is no exposure to things and the bright side of the Internet.

exactly, and that's not your fault at all, this is what teachers ought to teach you if they had any ethics and any level of pride in their work

> Also, for this to solve, one thing we can do is start FOSS and cybersecurity Clubs and build a culture among them through various ways like competitions, workshops, code-sprints, hackathons, CTFs and lot more which can be solved. Keeping that in mind, from our uni we have Started CTF competitions and bootstrapping them through workshops,

super nice, but also super sad that things are so bad that students have to take the place of their teachers :) as it's the teachers who get paid

Well, teachers aren't interested in all these. They just teach in some rote learning fashion. But at least having CS as subject helps to create interest in students about programming. That's it.

Even in Engineering courses, some teachers don't even properly indent code and can't even write themselves a recursive algorithm for eg: printing a number in binary. This is not an issue limited to CS/programming, but manifests more because it is a practical subject and a fast growing fields.

But some students get interested in programming earlier rather than rote learning other choices of subjects (eg: biology). That's the benefit of having CompSci/Programming in curriculum.

Source: learned programming in turbo C++ in India during my HS (called +2 or Pre-university here).

My high school taught BASIC PLUS on a DEC PDP-11. Granted this was in 1977.

How wide spread was this then? It seems like in the late 70s and 80s a lot of children (as in less than 15) learned programming young but this has dropped off in the 00s with the general rise of helicopter parenting and infantilization[0], and even with things like arduinos and such it seems like kids pick it up in class but then move on to other things. You certainly don't have young people actually end up developing actual things apart from the exceptions.

[0] this is my hypothesis around this in general tbh.

They teach "programming" but it's really making a simple web page.

First year of programming is more about learning the basics and not the language. Like the students will learn basic stuff like finding the digits of a number or implementing other algorithms. Then passionate students discover the graphics libraries and then start playing with that draw different cool stuff like effects or make simple games like Tic Tac Toe.

conclusion, in first year in schools you might have different level of students, they do not learn a language so they start a career with that language, they start with the basic stuff and hopefully a large number of students are attracted. Probably the teacher is lucky if majority of the students could handle homework on their-own so attempting to add more information that is not relevant is not useful.

I am attempting to teach my son programming, he likes to play Gary's mod and there he can script stuff, I observe very interesting things(he is 14) like I need to explain and force him to ident the code to make it readable (imagine how extra messy would be with python) or I explain a few times that you can have local variables or function parameters reuse same names but for some reason he gets confused when 2 different things have same name. 1

If it's still the case then the Vietnamese curriculum (in middle and high school) still teaches Pascal using Turbo Pascal. They (the Ministry of Education) probably doesn't feel like modernizing it though because it's not widely taught, and from my own experience most students (and teachers!) neglect it anyway.

Actually I think TP is quite good for that. Compilation time is (really) fast, and it is close enough to the metal to learn about the foundational structure of the computer and programming languages; the language is well defined. Syntax is (sort of) shared by ada if one later needs production grade.

Of course, the counter argument is, that it is kind of boring (except for some kids). Alternative is a language, where you easily can get things done. So maybe Python, but thats about it. I am still sad, that LOGO is not used anymore (there is much more to logo than turtle graphics).

Yes, even Bjarne mentions this in one of his talks.

Not sure what to think really, should we get angry how younger generations get taught so outdated information, or be happy that at least they learn something that will allow them to jumpstart into something better years later.

>Not sure what to think really, should we get angry how younger generations get taught so outdated information

(I'm an Indian that learned C++ in school using Turbo C++ 10 years ago.)

Outdated? The point of learning programming at that age is to understand the basics - functions / if / for / while, structs / classes, and pointers. All of those work the same in Turbo C++ or in the latest MSVC.

Sure learning C++ via Turbo C++ doesn't prepare the student for modern code that uses `<algorithm>` or `std::shared_ptr` (or `std` at all), but those can always be learned later. The basics are more important.

If anything, the fact that Turbo C++ came with graphics.h meant I could make screensavers like starfield and a visual sudoku solver by myself without any hassle. It made programming fun and was certainly part of the reason I'm a programmer today. I'm not even sure how I would do those with MSVC or gcc today, let alone 10 years ago. WinForms + GDI? SDL? Both are much more complicated than what I remember of graphics.h's API.

Edit: graphics.h was the header with the graphics API, not conio.h

I remember the time when I was a teen and started out with TurboPascal 8. It was a really polished experience with the inbuilt library being enough to do anything console (even a GUI framework). Very found memories and it did show me the basics that I use today without overwhelming with details, squabblings and arcanea (it was fairly consistent). Very different to the patchwork you find if you start today and the constraints to work with a limited set of tools was really great for starting out. Throw an NPM ecosystem with a million terms at a kid today who tries to start out and you have lost the spark. Kids only categorize programming as fun or chore once and it sticks. Luckily there is still Python (you can get very far by limiting yourself to the standard library and it leaves space to actually focus on the exploration of programming).

I guess you mean Turbo Pascal 7. :)

Yes, outdated, I used Turbo C++ when it came out fresh from Borland software factory, so I know what I am talking about regarding C++ support in Turbo C++. While C support was a mix of K&R and ANSI C, depending on the Turbo version.

All Turbo C++ versions for MS-DOS or the later Windows 3.x versions are older than ISO C++ and have semantics that eventually changed across versions.

Then there is the whole point of them being MS-DOS/Windows 3.x products that run in modern computers with various degrees of success.

There are open source clones of graphics.h and conio.h, and any good teacher could prepare the class material so that the students wouldn't have attrition.

And it isn't just talk, I spent one year doing TA activities so I know how much it costs to prepare such student materials.

Any talk of how compliant Turbo C++ is to modern C++ is missing the point of my post. I'll say again, the point of learning CS at that level of schooling is to learn programming, not learn C++ and instantly be hirable as a C++ developer.

I learned C++ at the 11 grade, back when Turbo C++ 1.0 was still quite recent on the market, and was giving classes to fellow classmates about OOP with Turbo Pascal 5.5, as payment for accessing school software packages and manuals, so I do know a couple of things what about matters at that age, and giving a good preparation for the work market.

Sute, basics are basics, but why not just install QtCreator? Modern day C++ with modern day tooling, GUI, that in all likelihood runs on the machines the students have.

I'd agree with you a decade ago, but nowadays Qt is all over the place (I still like it, just not good to start out - two GUI frameworks in the core library, which one do I choose; the docs certainly don't help). Today you fare better with something like Lazarus to start out or Python if you ignore the GUI.

Oh but you dont need to use Qt at all when using QtCreator. Its just the most fully featured free C++ IDE I know.

On top of that, regular old Qt is still one of the most fully featured GUI frameworks, QtQuick is mostly used for mobile and embedded, even though it also works on desktop. Lazarus or Tkinter aren't better choices for starters, I say as someone who used both.

Qt(Widgets) certainly is good if you know how to use it, you just need someone to tell you what parts to ignore when starting out. Here I put on the "teen who interacts first time with the concept of programming" glasses because of the thread, and consistency and constraints benefit that situation. Unguided first contact with programming through the mess that Qt is today is somewhat counterproductive in this respect. Look at the documentation page for Qt, that's certainly no place where an unguided newcomer could find their way around easily.

Granted, documentation isnt that great for Qt (but there's a ton of other resources). But doing anything more than the simplest of GUI is supereasy with Qt, much easier than TKinter, and IMHO even Lazarus.

But, even if you don't like Qt, QtCreator is still a great IDE. No need to keep using a Dosbox with Turbo C++.

Learning C++ with Borland Turbo C++ for DOS can have some learning value, but landing a C++ job with that may not be easy.

gcc and clang are distributed free of cost, and so is Linux. They should switch to those compilers and teach a modern dialect of C++.

Many teaching faculty are resistant to change because it requires them to learn something. That's the biggest problem. although some boards have successfully switched to teaching python.

I had a professor who would update his slides during lecture to be more compliant with the newest version of C++

Yeah, we were taught the basics of C++ in 7th grade using Turbo. However, the two major boards of education here use Java and Python in high school now so from 8th grade onwards we did most of our work in BlueJ (examinations still happen by writing programs on paper, though).

”examinations still happen by writing programs on paper, though“

When i studied CS at the uni ~2007 we also did it like that for our intro programming courses. I enjoyed it :)

I wonder how many of us who started on the "wrong" language or outdated tooling were actually handicapped by doing so in the long run. I started on BASIC, the kind with line numbers.

What is used in other countries? I assume Visual Studio or Eclipse? We used Code::Blocks in our high school.

When I was a TA (late 90's), we were using Windows 98 with Visual C++. Memory is fuzzy, I think it was version 5.0.

Each student had their own area on a file server which would be mounted locally and the exercises and respective support material for integration into VS as per exercise were available on the server as per lab session.

I've also heard of gcc/g++ being used along with vim or Geany.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact