Open olivierobert opened 1 year ago
Hi, your suggestion for the SearchEngine
is very reasonable. I thought about it initially but I decided to include search engine name in the search
function to make it flexible. Since you only need to create one instance of SearchEngine
and can search across multiple search platforms (Google, Bing, etc). I'll have a think about it and make improvement tomorrow if need be.
Aside from that, I completely agree to refactor hardcoded value into a config and rename the directory to Services
to suit its purpose better.
Please refer to this pull request #9
Issue
Using an interface and using a builder pattern are good ideas. There are still some ideas to improve the current implementation:
https://github.com/paladin3895/google-search/blob/9e652a7fab9f1073318c4bbb09de4fafba9de5cc/app/Jobs/KeywordSearch.php#L46-L48
to:
https://github.com/paladin3895/google-search/blob/9e652a7fab9f1073318c4bbb09de4fafba9de5cc/app/Utils/Search/GoogleSearch.php#L28
You could check to move other hard-coded values to constants too.
Services
,UseCases
, orInteractors
.Utils
is usually more suited for helpers, so not a great pick for naming this business logic.Let me know your thoughts on the proposed improvements 🙇