Hacker News new | past | comments | ask | show | jobs | submit login

  <ul>
      <% for person in db.query("SELECT * FROM people") { %>
          <li><%= person["name"] %></li>
      <% } else { %>
          <li><em>No people found!</em></li>
      <% } %>
  </ul>
I don't think that mixing view and model code in an example is a good idea. The reason is that it encourages mixing different concepts / abstraction levels which will result in confusion and maintainability issues in the long run.

For example if you happen to change the table name from people to humans you will have to change all code which uses people. It is not probable but it might happen.

If your language is not intended to be used for more than a few lines scripts then just ignore my comment.




It's just a concise example to demonstrate template and logic at the same time. Introductory PHP looks like that.

No where is he writing "Okay, let's start with an example on how you should be coding."


If this project used Ruby, it would be an approachable tool for back-end web development neophytes to learn with before moving on to Sinatra and Rails.


I'm glad they mention this on the main page:

  HTML escaping by default
Otherwise this example would make me even more uneasy :)


I think it's a pretty good example to show that it supports the same embeddable-ness of PHP (which is great for prototyping).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: