![]() |
Extending own libraries with good OO - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Extending own libraries with good OO (/showthread.php?tid=63803) |
Extending own libraries with good OO - RobertSF - 12-10-2015 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 RE: Extending own libraries with good OO - RobertSF - 12-11-2015 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? ![]() RE: Extending own libraries with good OO - solidcodes - 12-11-2015 Ooops. sorry wrong answer. How about just follow SOLID ? RE: Extending own libraries with good OO - RobertSF - 12-11-2015 Yes, good idea. I was just reading https://en.wikipedia.org/wiki/SOLID_(object-oriented_design) |