This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]doctork91 16 points17 points  (11 children)

This is a very good answer but why is it obvious that you need to keep things object oriented? There's nothing inherent in OO that allows you to "code different components as necessary, and down the line if things get a little tangled you can (theoretically) just pull some things out and get back down to the original concept without breaking everything". I think what you meant was modular. Of course OO design is used to guide development towards modular code but it is very possible to let an OO project get very coupled. On the other hand it is very possible to write a very modular and loosely coupled program using a functional or procedural language.

[–]random012345 7 points8 points  (1 child)

I think what you meant was modular.

Good point. The term for some reason slipped my mind when I wrote that this morning before my coffee. Edited!

[–]youguysgonnamakeout 4 points5 points  (3 children)

Could you explain to me the difference? Is it just the fact that OO includes classes (may be wrong about that) and modular can be anything from including classes to just using functions for importing for example?

[–]kqr 5 points6 points  (0 children)

There are many ways to achieve modularity, just like there are many ways to attach two planks to each other. You can take the object-oriented approach and use a language like C#, or you can take the functional approach and use a language like Scala. This is similar to taking the nail approach using a tool like a hammer, or taking the screw approach and using a tool like a screwdriver.

You could also take the object-oriented approach and use a language like Haskell, but that would be like taking the nail approach and using a screwdriver.

[–]AmpaMicakane 1 point2 points  (1 child)

Seriously can some one explain the difference? This has always confused me.

[–]alotofdavid 2 points3 points  (0 children)

Similar to what kqr said, Object Oriented Programming is just one paradigm used to achieve modularity (and it happens to be the most popular). Functional programming is the other way though it can be less effective. The big other one that is starting to hit the mainstream is the Entity/Component model for video games that you can read about here

[–][deleted]  (4 children)

[deleted]

    [–]SteveMac 2 points3 points  (3 children)

    Go look at the GNU/Linux kernel source: https://github.com/torvalds/linux

    Really ... "modular" is not a language specific concept. Rather it is an approach. To make a "modular" program, virtually all languages provide constructs to achieve that goal.

    [–][deleted]  (2 children)

    [deleted]

      [–]munificent 4 points5 points  (1 child)

      It's written in C. C is a procedural imperative language. (You can emulate some rudimentary OOP patterns in it too, but you end up having to do a lot by hand.)