What design route should I take?

So I’ve taken on a project at work that I’m having a hard time attacking, and I’d love some feedback and suggestions.

I work for an online retail store where we have an old, +7k-line script that we use to create various product feeds (mostly for CSEs like Google Products, Pricegrabber, etc). It’s become a complete mess, mostly because each feed is slightly different and because there is almost no separation of concerns.

I’ve been tasked with refactoring it, a task I volunteered for with gusto, and pretty soon I need to come up with a design. My main goal is to have a system that’s easy to maintain, and easy to add new feeds as needed. If performance suffers a bit that’s not a huge concern, though increasing performance would be great if it doesn’t interfere with the first two goals.

Until now, most of what I’ve worked on has been fairly linear and imperative; data comes in at the top and goes out at the bottom. But because of the various feeds with various needs, I wonder if an object-oriented approach would be beneficial. OO programming is still a bit of a mystery to me, so this problem has been a bit difficult to attack.

My basic idea is as follows; objects exist for each main concern (images, product descriptions, file handling, etc). Then, each feed has an object (perhaps implementing an abstract class) that talks to the other objects, asking for the information it needs. For instance, the Pricegrabber object feeds the Image object a list of products along with some parameters (maximum image size, etc) and the Image object returns a list of products with corresponding image urls. This way, the Pricegrabber object doesn’t know or care how the Image object finds its urls, or what mysql tables the Image object used or created; it just enters a list of products and gets a list of image urls. Pricegrabber does this with every main object until the feed file is created.

Main questions:

  • Does this design pattern make sense? Is there a better pattern I could use?
  • Does OO seem like overkill for what I’m trying to accomplish?
  • While we normally use Perl for our reports, would it be worth it to use PHP instead? If so, why? (I’d love to use Python or Ruby but IT has put the kabosh on that).

Does this design pattern make sense?

What you’ve described is not a pattern, but rather kind of informal description of application architecture. You better don’t think of it right now.

Try to create a domain vocabulary which describes all the things your application deals with:

  • feed (which has defferent fields),
  • product (which consists of photo, description, price, etc.),
  • customer/user,
  • order,

This would help you understand which classes/interfaces you’ll probably need. Patterns would come next, as (and if) you need them.

If you’re new to OOP, you shouldn’t start using patterns right away. Just learn the basics and try to write the most simple code that does the job. Don’t write the code that you don’t understand (see Cargo cult programming).


Does OO seem like overkill for what I’m trying to accomplish?

Totally not an overkill. OOP is just a way of solving problems, not a technology. Of course, it can be used in a wrong way, but what you have now (solid piece of bare structural code) is much more wrong.


While we normally use Perl for our reports, would it be worth it to use PHP instead?

I don’t have any experience with Perl, but I think it doesn’t matter that much. Pick what you like more, just remember that PHP is simpler (IMO) and has larger community (which isn’t necessarily better).

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật