Show HN: Enlight – Learn to code by building projects

(tryenlight.github.io)

322 points | by shamdasani 2327 days ago

19 comments

  • ThePawnBreak 2327 days ago
    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/

    • shamdasani 2327 days ago
      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.
  • warent 2327 days ago
    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

    • mncolinlee 2327 days ago

        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.
    • shamdasani 2327 days ago
      Good point - will add something on that soon. I by no means am a professional programmer, just a hobbyist sharing what I've learned.
      • ColinFCodeChef 2327 days ago
        The gap between a professional and hobbyist is nowhere near as wide as one might think. Great idea, keep at it.
        • warent 2327 days ago
          Unrelated: you joined >400 days ago and this appears to be your first post? Cool!
      • s4vi0r 2327 days ago
        Why the `var`s everywhere in the example? They should really be `const`s
        • inimino 2327 days ago
          `var` still works everywhere, right?
          • akvadrako 2327 days ago
            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.
            • inimino 2326 days ago
              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.
            • rapind 2326 days ago
              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.
      • inimino 2327 days ago
        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.

        • shamdasani 2327 days ago
          Thanks for the heads up. DOM methods are more clear and better. Will update the tutorial soon.
        • foota 2327 days ago
          innerHtml wouldn't eliminate xss vectors though, things like load=something could bypass this.
          • inimino 2325 days ago
            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.
    • hxtk 2327 days ago
      Would running inputs through a markdown engine on the server side fix this, assuming it didn't break some other design requirement?
      • girvo 2327 days ago
        Markdown allows HTML, though. You have to pick your engine or configuration carefully there, but the idea is sound.
  • tuvtran 2327 days ago
    Shameless plug but once I made a repository of projects to learn programming: https://github.com/tuvtran/project-based-learning
    • shamdasani 2327 days ago
      Great job! You think some Enlight projects would fit well there?
    • whatyoucantsay 2326 days ago
      Those project listings look brilliant!
  • graniter 2327 days ago
    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!
    • fergie 2327 days ago
      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.
      • brownra04 2327 days ago
        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?
        • fergie 2326 days ago
          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.

        • meebs 2327 days ago
          If you can afford to go back to college you have enough money to do Recurse Center or something more practical than college.
  • laurentdc 2327 days ago
    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.
    • shamdasani 2327 days ago
      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.
  • KajMagnus 2327 days ago
    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 :- )

    • shamdasani 2327 days ago
      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.
  • Pranz 2327 days ago
    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.
    • shamdasani 2327 days ago
      Thanks for letting me know.
  • forg0t_username 2327 days ago
    The animation of what you're going to build before even clicking on it is super neat, kudos!
  • sondh 2327 days ago
    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?
    • shamdasani 2327 days ago
      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 :/
  • sifex 2327 days ago
    Another shameless plug for http://sudo.org.au/. We do exactly this, thanks for sharing shamdasani! :)
  • metahost 2327 days ago
    A question. For the database side of things, do mainstream chat apps use the PubSub model? If not, what then?
  • psergeant 2327 days ago
    What would make these dramatically more fun for me is the examples instead being exercises
  • JonasJSchreiber 2327 days ago
    Fantastic! Conveys complex problems in a simple, easy to consume manner. Well done!
  • JCSato 2327 days ago
    You're a class act, shamdasani. Thanks for sharing. :)
  • wherewulf1 2327 days ago
    Learning to program right now. This is highly motivating!
  • holychiz 2327 days ago
    feature request: add discussion page for project discussion, getting help, suggestions, etc.
    • shamdasani 2327 days ago
      That's the plan. Any suggestions for forum software? Discourse? Flarum? Trying to implement it before the new year.
      • KajMagnus 2327 days ago
        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.

        • Roverlord 2325 days ago
          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.
      • the-dude 2327 days ago
        HN?
  • klokoman 2327 days ago
    This looks fun, good job
  • Taniman 2327 days ago
    S-H-A-M then Dasani like the water company nothin to it.
  • fernly 2327 days ago
    Chrome thinks "This page is in [Luxembourgish]" ... wtf?