Building CMS from components

I have a design decision problem and would like to have some thoughts on it.

I’m building a CMS to use for my projects and want to incorporate existing components in it, like Doctrine, Monolog and any other i find suitable.

The question is, should I allow in code to access this each component directly, or should I have a buffer (proxy) class that acts as an API to underlying component?

In terms of performance/ease and access to full functionality i think it is better to allow this access, but in this case I lose control when component behavior changes (major version upgrade etc.). If I had a buffer class, i don’t lock myself to particular component, and even can replace it with another, while not breaking backwards compatibility, but in this case I have to almost duplicate code from the component (I mean, function from my buffer class calls functions from component)

The CMS is written in PHP, if that matters.

1

You need to weigh up each component and think about whether it really makes sense:

  • You need to think about how likely it is that you will need to substitute one library with another. In the case of an ORM, you may want to substitute one RDBMS for another, but an ORM typically already provides that abstraction so it’s unlikely you’d also want to change your ORM.
  • You need to think about how universal the API of your proxy would be. There’s no point crafting an intricate proxy API if you won’t be able to maintain that API in the event you switch a component. For example, you probably wouldn’t be able to maintain the same API if it is your intention to switch from an SQL to a no-SQL DBMS. On the other hand, it might be reasonable to drop in a different crypto library because most of those have similar functions and APIs.
  • Would the effort of writing a new proxy layer actually be lower than just updating the main codebase? If a library deprecates a function or two every few years which are only used in a few places it would be hard to justify writing a proxy for the whole library in case a small number of those functions happen to change which would only take minimal effort to update in each instance any way.

As general examples:

  • I probably wouldn’t proxy an ORM because an ORM is already an abstraction, it would add significant complexity to transform the data structures returned by an ORM into something generic, and I’m probably not going to have a compelling reason to switch.
  • I probably would proxy something like a cloud object storage API, because it’s likely that I might want to use a different storage provider in future and they often have a similar or identical API.

Perhaps more important than their API is your API.

If:

  • Your API is well defined, particularly in terms of what APIs are public and not
  • Your API does a good job of encapsulating the libraries within (ie. it avoids exposing implementation/library specific constructs to external consumers)
  • Your API is well covered by an automated test suite

Then even if you have to do significant re-plumbing of your application to replace a library or upgrade to a version with an incompatible API, you can at least be confident that your system still functions the same as it did before from an external perspective, and that you’re not passing these problems onto your users.

Why don’t you have a look (for example) at Symfony DBAL or Templating interface? If you want to provide components with different underlying extern implementation you will define your interface components and then provide a couple of adapters for those other libraries.

To keep it backward compatible simply don’t change the interface. If something for example Doctrine changes you can change the adapters.

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

Building CMS from components

I have a design decision problem and would like to have some thoughts on it.

I’m building a CMS to use for my projects and want to incorporate existing components in it, like Doctrine, Monolog and any other i find suitable.

The question is, should I allow in code to access this each component directly, or should I have a buffer (proxy) class that acts as an API to underlying component?

In terms of performance/ease and access to full functionality i think it is better to allow this access, but in this case I lose control when component behavior changes (major version upgrade etc.). If I had a buffer class, i don’t lock myself to particular component, and even can replace it with another, while not breaking backwards compatibility, but in this case I have to almost duplicate code from the component (I mean, function from my buffer class calls functions from component)

The CMS is written in PHP, if that matters.

1

You need to weigh up each component and think about whether it really makes sense:

  • You need to think about how likely it is that you will need to substitute one library with another. In the case of an ORM, you may want to substitute one RDBMS for another, but an ORM typically already provides that abstraction so it’s unlikely you’d also want to change your ORM.
  • You need to think about how universal the API of your proxy would be. There’s no point crafting an intricate proxy API if you won’t be able to maintain that API in the event you switch a component. For example, you probably wouldn’t be able to maintain the same API if it is your intention to switch from an SQL to a no-SQL DBMS. On the other hand, it might be reasonable to drop in a different crypto library because most of those have similar functions and APIs.
  • Would the effort of writing a new proxy layer actually be lower than just updating the main codebase? If a library deprecates a function or two every few years which are only used in a few places it would be hard to justify writing a proxy for the whole library in case a small number of those functions happen to change which would only take minimal effort to update in each instance any way.

As general examples:

  • I probably wouldn’t proxy an ORM because an ORM is already an abstraction, it would add significant complexity to transform the data structures returned by an ORM into something generic, and I’m probably not going to have a compelling reason to switch.
  • I probably would proxy something like a cloud object storage API, because it’s likely that I might want to use a different storage provider in future and they often have a similar or identical API.

Perhaps more important than their API is your API.

If:

  • Your API is well defined, particularly in terms of what APIs are public and not
  • Your API does a good job of encapsulating the libraries within (ie. it avoids exposing implementation/library specific constructs to external consumers)
  • Your API is well covered by an automated test suite

Then even if you have to do significant re-plumbing of your application to replace a library or upgrade to a version with an incompatible API, you can at least be confident that your system still functions the same as it did before from an external perspective, and that you’re not passing these problems onto your users.

Why don’t you have a look (for example) at Symfony DBAL or Templating interface? If you want to provide components with different underlying extern implementation you will define your interface components and then provide a couple of adapters for those other libraries.

To keep it backward compatible simply don’t change the interface. If something for example Doctrine changes you can change the adapters.

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