Structure project based on platform or design?

I have a medium sized project (~10,000 lines) that runs on Windows and Linux. However it is only specific components of the program that are platform dependent and are located in a folder called event_producers.

Now my main concern is to how go about organizing this folder since the project starts becoming more complicated and I would like to keep the organization at an optimal level.

Organization based on platform:

'-- event_producers
          |-- Linux
          |      '--- monitoring.py
          '-- Windows
                 '--- monitoring.py

This looks more implementation agnostic which is a bonus since someone can change things in the future without creating any new files. The main problem is that no one can guarantee that every programmer follows the pattern of having a file with the same name in each platform folder.

Organization based on design:

'-- event_producers
          '-- Monitoring
                 |-- linux.py
                 '-- windows.py

This doesn’t leave much space from the programmer to organize things in the wrong way. What bothers me is that I have a module called linux.py and windows.py, something I never came across in any other project. Also if in the future a new folder (say Activator) needs to be created, no one can guarantee that the programmer will follow the pattern of naming files according to the platform.

Questions

  • How would you organize the project and why?
  • Is there some other advantages/disadvantages with each way that I missed?

Good for you for factoring out the platform specific bits from the bulk of the code. I bet this helps keep the overall project manageable. I think your organization based on platform is the way to go. Platform-specific files go in platform-specific directories, and the files themselves can have names that match what they do. This keeps things very clear, which is a feature of a good design, IMO.

Yes, there is risk of someone omitting platform support when a new file/feature/event producer is added. You can mitigate this by adding a consistency check to your test suite that confirms that each platform has a corresponding set of files. This could be added to your build process so problems can be detected and surfaced early.

Alternatively, you could have a helper script that generates stub files for each (known) platform which are then edited to provide real functionality. You’ll also need to replicate all files when a new platform is added, but that’s a big job no matter how you approach it.

I think you are on the right track.

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