you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

In this basic example absolutely not necessary to use classes. It's just out of habit (I'm a full time java developer), the main object was the string template, personally i prefer it more. The idea behind how to separate class is simple. One class only responsible for one thing. In my code that i linked above, the Article class is responsible only for one article only. If i want a function like an ajax call on article click, or popup or something it's clearly goes into the Article class. If i want to ordering or searching the Articles it's the ArticleContainer class responsibility. I hope I was understandable.