Is it a good idea to build a library on top of somebody else’s library?

Is it a good idea to use somebody else’s library as a base and build your own library over that.

I want to make a JavaScript Canvas framework for a animation player on top of KineticJS. Should I do it? Do I need permission from the author of KineticJS? Do I just say to users to donwload KineticJS before my library, or do I just copy paste the kineticJS code in my library?

1

I see two perspectives to this:

Legal: Can you do it?
I see no reason you can’t. I know there are some laws/rules about bundling other people’s libraries, but that would probably only be for proprietary libraries or with licenses that have very specific rules against including them in other projects (This was the case for a company I worked at). I am not aware of any legal reasons why you can’t have your end-user go download it themselves; I believe Ubuntu has gotten around this issue just by having end-users download the drivers manually.

Design: Should you do it?
I once ran into an issue using a library and was getting a very weird error that made no sense to me. It turns out the error was stemming from the fact that the library I was using depended on another library that wasn’t referenced properly.

So if you use the KineticJS library just make sure that if they don’t include the library that you throw an error that tells them that the KineticJS library is missing.

Sure you can build your library on top of someone else’s. People do that all the time!

You shouldn’t need the permission of the author of the base library to do this (because you’re just referencing their code), but you might need their permission if you want redistribute their library with yours. This will affect how your users get the base library: if you are allowed to redistribute, then all is well. If not, you will have to direct them to the location where they can download the library they need.

To think of it from the other side:

Unless you are writing assembly on the bare metal, you are pretty much guaranteed to require other libraries, e.g. the C standard libraries, your operating system libraries, GUI toolkits, etc. Somewhere along the chain of execution, your code will involve several other libraries.

Building upon the work of others is a fundamental aspect of code re-use, and we wouldn’t make much progress if every single project had to start from scratch.

So, you should approach whether to use KineticJS the same way you would for whether to use a given language, operating system, etc.

Building a project upon a library is never free, including a library also means including that library’s bugs and download size.

Sometimes one may be able to consider the library an independent piece of code that need no maintaining and doesn’t really count towards the complexity of the project, but often that is not the case. As a professional developer the only way I can really justify using some small found-on-the-internet library is if I take care of that code as if it were my own. Maybe the original develop will fix a bug if I find one, maybe he won’t and I’d have to do it.

Ultimately an included library is part of the codebase, and as such count in every negative way like any other code. It may be good relatively bug-free code with a clean interface that thus doesn’t weigh much relative to its size, but the weight is never zero.

If library A depend on library B then including library A in my project implicitly adds the weight of both libraries.

You always want a library to be as lightweight as possible, including another library will almost always work against this goal. In some cases this will be a small extra weight added for a large benefit in saved work, in other cases it is a lot of weight for very little benefit.

Conclusion

Usually you should avoid library dependencies in libraries, but there are cases where the cost to gain ratio is low and it is acceptable. The following conditions in general make the use of a sub-library more acceptable:

  • The library used is a widespread one that generally has few bugs and is well supported.
  • All or most of the functionality of the library is being used, if the needed functionality were to be re-implemented the combined code-size would not be a lot smaller for it.
  • The library deals with issues that would be hard to solve without it.

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