Component programming

qznc qznc at web.de
Fri Aug 2 01:25:11 PDT 2013


On Wednesday, 31 July 2013 at 10:20:57 UTC, Chris wrote:
> This is only losely related to D, but I don't fully understand 
> the separation of component programming and OOP (cf. 
> https://en.wikipedia.org/wiki/Component-based_software_engineering#Differences_from_object-oriented_programming). 
> In an OO framwork, the objects are basically components. See 
> also
>
> "Brad Cox of Stepstone largely defined the modern concept of a 
> software component.[4] He called them Software ICs and set out 
> to create an infrastructure and market for these components by 
> inventing the Objective-C programming language." (see link 
> above)
>
> Walter's example 
> (http://www.drdobbs.com/architecture-and-design/component-programming-in-d/240008321)
>
> void main() {
>         stdin.byLine(KeepTerminator.yes)    // 1
>         map!(a => a.idup).                  // 2
>         array.                              // 3
>         sort.                               // 4
>         copy(                               // 5
>             stdout.lockingTextWriter());    // 6
>     }
>
> This is more or less how mature OO programs look like. Ideally 
> each class (component) does one thing (however small the class 
> might be) and can be used or called to perform this task. All 
> other classes or components can live independently. From my 
> experience this is exactly what Objective-C does. Rather than 
> subclassing, it uses other classes to get a job done.

A few days ago, there was a discussion about APL on HN [0]. What 
we call Component Programming here, looks somewhat like the APL 
style to me. Sure, APLers have a single weird symbol for stuff 
like "sort.", but this chaining of powerful modular operations is 
what APL seems to be all about.

The APL paradigm is not integrated into modern languages so far. 
I am excited that it might make an introduction now. Compare for 
example Functional Programming, which is integrated into most 
mainstream languages by now. Or Logic Programming, which seems 
not worthy enough to get its own syntax, but is available in the 
business rules world with libraries and DSLs and its minor 
brother Datalog is also still alive.

[0] https://news.ycombinator.com/item?id=6115727


More information about the Digitalmars-d mailing list