I just listened to Software engineering Radio podcast on components. Their description of components were very vague, they made them sound like lower level versions of functions. I am trying to figure out what components mean in the context of the composite pattern.What is the difference in purpose between a function and a component?What does a component have to do with the composite pattern?Can you describe what a component is by using a funny metaphor? For example, explain how  creating a component like baking an apple pie.
What is the difference between a function and a component?
design patterns;component
There is no clear notion of the term component. You could use it in many different ways. But if you go to the root of the word (in terms of linguistics) you have componere, which is itself a compositum of cum (with) and ponere (put). So if you put something together you have a composition of individual parts.There are two main aspects for components:Composition put togetherCompartmentalization independent things So a software component is a unit or part of software, which in itself could be used independent from the actual composition - but on the other hand is used to build a larger system. Ideally you have a software in which each component is orthogonal, which means, no component is dependent on another component and they do each their job, where no functionality is duplicated (a form of DRY).In most cases you could substitute component with part.I am trying to figure out what components mean in the context of the composite pattern.The point of the composite pattern is to put independent parts under a unique interface. You have the base component as a contract for each part to comply with. You have a leaf which is the part and you have the composite, which contains a collection of those parts.1) What is the difference in purpose between a function and a component?A component is the subject / carrier of a function ( in OO-terms).On the other hand, if you take functional languages, I think it would be okay, to speak of functions as components in a functional composition.In a broader sense, you could speak of a component in a whole, which represents one function: e.g. a printing component which stands for the function to be able to print.2) What does a component have to do with the composite pattern?See above: Composite is about putting together components.3) Can you describe what a component is by using a funny metaphor? For example, explain how creating a component like baking an apple pie.One way to put it: A component is like an ingredient for a meal.Another way to put it: A component is a player in a soccer game. Each of them is different and has to play another role in the game, but together, they are a team and play soccer.