Extending own libraries with good OO |
I'm working on a web scraper that turns web pages with rows of data (like a page of search results) into CSV files to use in Excel. Of course, there must be custom code for every site the scraper works on. Here is how I've arranged it, and it works fine, but I'd like feedback on the OO implementation. Not sure it follows best practices.
Here's the controller code. Give it the database row id of a search, and it will retrieve the search profile (search name, search url, etc.), load the correct library file, execute the scrape() function in that library, and then download the file. PHP Code: // controller Searches.php Then there is. PHP Code: // application/libraries/Site.php PHP Code: // application/libraries/Site_craigslist.php
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Yes, that's true. But my question wasn't about web scraping. It was a question about how to structure our own libraries. The question would exist even if it was a different application and not web scraping. Any ideas?
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Ooops. sorry wrong answer.
How about just follow SOLID ?
No SEO spam
Yes, good idea. I was just reading https://en.wikipedia.org/wiki/SOLID_(obj...ed_design)
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
|
Welcome Guest, Not a member yet? Register Sign In |