Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Matthew Francis
Matthew Francis
6,967 Points

The difference between module vs API?

I tried googling but I'm still confused, can someone dumb it down for me?

1 Answer

Steven Parker
Steven Parker
230,248 Points

These are both pretty broad terms.

The concept of module comes from modular programming paradigm which advocates that software should be composed of separate, interchangeable components called modules by breaking down program functions into cohesive units, each of which accomplishes one function and contains everything necessary to accomplish this.

In general terms, an API is a set of clearly defined methods of communication between various software components. A good API makes it easier to develop a computer program by providing all the building blocks, which are then put together by the programmer. An API may be for a web-based system, operating system, database system, computer hardware or software library. An API specification can take many forms, but often includes specifications for routines, data structures, object classes, variables or remote calls.

So in short, a module is a software component, and an API is instructions, and possibly some tools, for using and communicating with a software component.