Hacker News new | comments | show | ask | jobs | submit login
Show HN: Enlight – Learn to code by building projects (tryenlight.github.io)
322 points by shamdasani 8 months ago | hide | past | web | favorite | 52 comments



I think project based learning is the only way to actually learn programming. It's why most people suggest new programmers to "just build something they want" (which I think is bad advice). It's easy to envision a person reading 20 books and taking 3 MOOCs on programming not being able to tic tac toe game. It is far more difficult to envision someone who built 10 projects not being able to program.

What I dislike about the projects linked is that they give you all the code, rather than just giving you the challenge. Shameless plug: I started a blog about programming challenges (projects, not algorithms) where you just get the tests and you have to write the code. The first (and only, for now) project is a URL shortener: https://cmocanu.github.io/blog/post/url_shortener/


I understand where you are coming from. I think having code exercises and a more step by step process is something Enlight can improve upon. I love your URL shortner tutorial. Feel free to contribute a project or two to Enlight! Thanks for the feedback.


The [nodejs chat application](https://tryenlight.github.io/nodejs-chat) should at least briefly run through the perils of XSS and ways to sanitize inputs. The chat app lets you inject arbitrary javascript/html/css which noobs may not consider at all.

Otherwise, great idea! Should help a lot of people


  There once was a coder from Texas
  Who browsed websites on his Nexus.
  He used Dev Console
  Exploited a loophole
  And found a bevy of XSS.


Good point - will add something on that soon. I by no means am a professional programmer, just a hobbyist sharing what I've learned.


The gap between a professional and hobbyist is nowhere near as wide as one might think. Great idea, keep at it.


Unrelated: you joined >400 days ago and this appears to be your first post? Cool!


Why the `var`s everywhere in the example? They should really be `const`s


`var` still works everywhere, right?


Current coding examples should be using the current best practice, which is const. If you want to support old browsers without compiling the JS, you are going to have a lot more issues than const/var and is not for beginners.


The difference between `var` and `const` is irrelevant for beginners. `var` also happens to be the standard on deployed browsers and existing code, and every beginner should recognize it. It’s the least substantive thing you could pick to criticize about this code.


It's actually pretty easy to support older browser's without getting into the packaging mess if you don't need a modern framework. Learning webpack is a distraction from learning programming and would overwhelm a lot of the audience IMO.


Typing `<script>alert(0)</script>` into the chat box shows the injection hazard.

In fact this is caused by using jQuery, which (inexcusably) runs embedded scripts when adding HTML to the page. The simplest solution to this entire class of bugs is simply to not use jQuery and use the better-designed DOM methods instead, which is probably a more modern approach anyway.

Using innerHTML would solve the script injection, but you probably want to use innerText or createTextNode instead, since supporting HTML tags in a basic chat app seems more bug than feature.

The server side should be safe already as it looks like there’s no persistence.


Thanks for the heads up. DOM methods are more clear and better. Will update the tutorial soon.


innerHtml wouldn't eliminate xss vectors though, things like load=something could bypass this.


Yes, it's not completely safe. In a beginner tutorial, if you allow arbitrary HTML you should state that it shouldn't be done that way in a real app.


Would running inputs through a markdown engine on the server side fix this, assuming it didn't break some other design requirement?


Markdown allows HTML, though. You have to pick your engine or configuration carefully there, but the idea is sound.


Shameless plug but once I made a repository of projects to learn programming: https://github.com/tuvtran/project-based-learning


Great job! You think some Enlight projects would fit well there?


Those project listings look brilliant!


I get a number of people asking me how to become a programmer as a second career. For most of them, I wouldn't recommend going to college for it, but instead learn it on the side. Project-based learning I think is the best because it matches more "real world" programming and it's fun to see the results of your work. This seems like a good resource that fits right into that approach. I'll be passing this on to others. Good job!


Its 2017. "Don't go to college" has always been really bad advice, and has never been more so than right now. If you go to college and do well in CS, you will have tech companies asking you to join them. You will also be equipped to takle unsolved problems, and make new services. Go to college.


What would you recommend for someone who already went to college in an unrelated field but is looking at CS/programming as a second career? Is the degree that important, or would an alternative path serve a returning student better?


Yes, a degree make a massive difference, particularly if you aspire to work in an established technology environment. Decide what you want to do, and then work out what you need to do to get there.

If you dont want to do a degree- what then do you do? Basically you have to somehow get experience. But if an employer is willing to take you on without any experience, then that is probably not a place that you want to work. They will have low standards and poor pay and conditions, and therefore churn out poor products. So it is unlikely that this will create a "stepping stone" that will get you where you want to go.

To cut a long story short, since getting up to speed is realistically going to take you a year or two anyway, you might as well go to college.

I dont mean to sound grumpy here, but I just feel that there is concerted effort from some quarters to talk down the value of a good education when clearly if you look at Silicon Valley, education is valued really highly.


I would add some depth to some of the beginner/intermediate tutorials. For example, in the to-do list project you could introduce something like localStorage to make it persistent. It's only a few more lines of code but opens up a whole new topic.


Makes sense. I added localStorage to the text editor, but adding depth to other projects enhances not only the app, but now the user knows more features to implement in their future projects. Thank you.


This looks interesting. Do you want some feedback about the homepage?

This: "Subscribe to email list: Join 1,000+ developers and get notified of new projects" makes me wonder: what kind of projects will I get notified about? Can I get notified only about certain types of projects that I'm interested in?

And how often will I get notified, is that configurable? Once a week, or every 2nd week, is probably enough for me. My inbox gets too many notification emails already.

I'd definitely sign up for notifications, if I could choose to receive only notifications about stuff similar to Discourse, Slack, StackOverflow, Disqus, wiki software, Diaspora, Facebook, Scuttlebutt, which I'm particularly interested in.

Nice initiative :- )


Thank you for the feedback. I will definitely consider this in the future (when I make my own mailchimp like service) as users would benefit from this.


There's a gradual color change in the header of https://tryenlight.github.io/guide, which is fine and all except the text isn't legible when the color is red.


Thanks for letting me know.


The animation of what you're going to build before even clicking on it is super neat, kudos!


Just a GIF ;)


I subscribed via MailChimp and got a link to go back to http://enlight.ml but a MacKeeper ad popped up. I tried again in incognito and it showed some other generic ads. Probably a bug?


Yep that’s a bug. Will fix shortly. Enlights old domain was enlight.ml until freenom took away the domain. I guess that’s what happens when I use a free domain :/


Another shameless plug for http://sudo.org.au/. We do exactly this, thanks for sharing shamdasani! :)


A question. For the database side of things, do mainstream chat apps use the PubSub model? If not, what then?


What would make these dramatically more fun for me is the examples instead being exercises


Fantastic! Conveys complex problems in a simple, easy to consume manner. Well done!


You're a class act, shamdasani. Thanks for sharing. :)


Glad to hear :)


Learning to program right now. This is highly motivating!


Glad to hear


feature request: add discussion page for project discussion, getting help, suggestions, etc.


That's the plan. Any suggestions for forum software? Discourse? Flarum? Trying to implement it before the new year.


You might want to check out EffectiveDiscussions too: https://www.effectivediscussions.org. It's like Discourse + StackOverflow (Q&A) + Slack (chat) + HackerNews. (I'm developing it.)

Later this week I'll release a slightly new version that'll make it the probably fastest forum software out there :- ) But Discourse is more stable & well tested.

Here're some features you might like, if you like HackerNews: https://www.effectivediscussions.org/-32/how-hacker-news-can...

Discord (chat) is fairly popular too. But maybe not so great for Q&A because everything scrolls up-and-away in a pure chat.


This is interesting stuff, good luck! Is it being used on any good public sites yet, would love to see how it gets used in the wild.


HN?


This looks fun, good job


Thanks :)


S-H-A-M then Dasani like the water company nothin to it.


Chrome thinks "This page is in [Luxembourgish]" ... wtf?




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

Search: