jeudi 26 janvier 2017

How are separate responsibilities created in symfony?

This question is a bit hard to explain, but I'll try my best.

Say, I am creating an job add aggregator site. For this, I have 10 job sites I will crawl through, parse the HTML and get all the juices.

Now, since each sites template, url and the amount of information they contain is unique, something tells me the crawling part should be organized separately.

Normally, I could put it all together in

class CrawlerController extends Controller {

    public function fooDotComAction(){

    }

    public function barDotNetAction(){

    }
}

You can see the above is still better than dumping all my crawler logic inside the DefaultController, but even my example doesn't seem efficient, or modular.

It seems like a bad practice, I am wandering if there is some sort of feature in Symfony that provides an implementation or guide for such problems.

Aucun commentaire:

Enregistrer un commentaire