|
|
|
|
|
by edem
4619 days ago
|
|
<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. |
|
No where is he writing "Okay, let's start with an example on how you should be coding."