3
Bubbles
6y

Okay so this has been bugging me. I know object oriented is important and helpful and good over all, but how much do people in the field with jobs use it. And this applies to any language I'm just curious.

Comments
  • 1
    Dude, literally every day, all of the time.

    I know functional programming is the new hotness but soon that too will fall back to the same place every other methodology and/or tool lives. Waiting to be used in the right place at the right time.
  • 0
    @CodeMonkeyG I'm trying to work on getting better with it that's why I'm asking also it's a pain sometimes
  • 1
    @Bubbles Both can be a pain when misused.

    I think what works best is to understand the principals of both and use them where they make logical sense.

    Example:

    If I have a bunch of objects that represent some data model and I want to get some insight into them, I wouldn't create another object just to look into and get a result from my existing objects nor would it make sense to add a method on these objects that talks to "siblings". I would just write a function that takes the objects in as input and gives me some output.

    On the flip side if I want to manipulate these objects, I wouldn't write a function that can't be used for anything else but sits out somewhere by itself, I would just give that object a method that would manipulate it as desired.

    Basically, if your absolutely set in one methodology you lose the benefits of the other methodology while having nothing to cover the shortcomings of whatever method you decided to strictly stick with come hell or high water.
  • 2
    Nearly all the code I write is OO. There’s a time and a place for functional, but I much prefer OO. I find aligning the object graph to the business problem to be a very useful exercise, and also find it easier to divide a project up between the team members.

    I code mostly in C#. As the language evolves it’s pulling more and more features from F#, so you get functional features within a fundamentally OO language, so you get the best of both.

    Whatever your preference, learning different paradigms is important IMHO.
  • 2
    The time and place for functional is always, oop can be functional and f# is total garbage. It is ms clone of erlang and a shit one at that. Only after using Haskell and erlang can you understand this all ms does is clone other generally better battle tested languages. Ex Cisco has released over 2 billion devices using erlang. And Cisco is at the top of their game in the routing world.
  • 1
    @oudalally tru but also erlang doesn't block context as it doesn't hold ints on the stack just pointers this each page can be quickily disposed of as it just points to a memory address where the function resides vs waiting for each clock cycle to access a different page
  • 3
    Any time you write any polymorphic code you are doing Object Oriented Programming. You can do it in non-OO languages. You can do the same stuff in C or Clojure. OO languages are really so-called because they make it easier and safer.

    Any time you define an interface which can have multiple different implementations, and those implementations can be swapped out at will without the client code needing to change, you are doing OOP. And it doesn't have to be a literal Java "interface", it could be an abstract class, or even just a function that takes another function as an argument, it's all polymorphic, and therefore OO.
Add Comment