nguyencaothangtp / google-crawler

Small demo project
0 stars 0 forks source link

Why is crawlGoogleByKeyword defined as a helper? #16

Closed olivierobert closed 4 years ago

olivierobert commented 4 years ago

Currently the class Helper is the host of numerous and unrelated functionality such as parsing a CSV, removing an empty element in an array (also array_filter might be of use there) and the Google crawler. So why opting to share all of this in the same class 🤔 ?

nguyencaothangtp commented 4 years ago

The parseCSV (read csv file and return all values in an array) and crawl google functions could be reuse multiple times in different places in the app, so i thought one way to make it more convenient and more reusable through out the app is to put them in a Helper

olivierobert commented 4 years ago

How objects are used should not really defined how they are structured. Also, when it comes to testing having separate classes or modules with related domain make things so much easier.

nguyencaothangtp commented 4 years ago

One of the solution i was thinking of is to create 2 classes: CSV (with readCSV method), Crawler (with getGoogleStat method) so that each object does its own job and there will be separation of concern.