d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Discovered Something About Oop Design Patterns > Useless Rambling
Add Reply New Topic New Poll
Member
Posts: 21,211
Joined: May 22 2009
Gold: 9,036.90
Jan 7 2017 03:56am
If you take a look, some design patterns are solutions to problems that arise only in languages that have strong type systems.

This is not to say that strong typing is bad, but this is just something i was thinking about.

Think about the decorator pattern implemented in Java or C++. It allows you to add additional functionality or information to an object that has already been created but it is done using abstract classes, subclasses, calls to superclass methods etc.

If you take a look at a dynamic language like Javascript or ruby, this design pattern is irrelevant because you can just smack on additional functionality using object.functionality = 'xyz'


What about adapter pattern? Similar things can be said. Due to the lack of strong typing in js and ruby you often won't need to (explicitly) write classes that will convert the interface of one class so that it can be used by another. Any object with the necessary methods can be used, and the wrapping can be more easily accomplished

Same with the strategy pattern, there won't be a need to create an abstract superclass to have a common type between your strategies, you can just plug in any object that has the method you need to execute.

Of course many patterns will be present in both, like the singleton pattern, factory pattern, builder pattern, observer etc.

Dont know if any of this is making sense, I am writing it at 5 am lol

This post was edited by zeroRooter on Jan 7 2017 03:57am
Member
Posts: 36,389
Joined: Jul 18 2008
Gold: 3,192.00
Jan 7 2017 06:58am
I disagree. I think object oriented principles server to make code more maintainable in the long run.
Member
Posts: 1,039
Joined: Jul 8 2008
Gold: 1,939.50
Jan 7 2017 01:34pm
Quote (Mastersam93 @ Jan 7 2017 07:58am)
I disagree. I think object oriented principles server to make code more maintainable in the long run.


What relevance does this have to what he wrote?
Member
Posts: 21,211
Joined: May 22 2009
Gold: 9,036.90
Jan 7 2017 05:05pm
Quote (Mastersam93 @ Jan 7 2017 07:58am)
I disagree. I think object oriented principles server to make code more maintainable in the long run.

Yea
Quote (waraholic @ Jan 7 2017 02:34pm)
What relevance does this have to what he wrote?


It's okay I don't blame him for not reading my blob of crap lol
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jan 7 2017 05:54pm
What are some examples of these design patterns.

I've never been very big on OOP concepts so I am interested in what these look like.
Member
Posts: 21,211
Joined: May 22 2009
Gold: 9,036.90
Jan 7 2017 06:11pm
Quote (AbDuCt @ Jan 7 2017 06:54pm)
What are some examples of these design patterns.

I've never been very big on OOP concepts so I am interested in what these look like.


do you know c++? I think i have examples in c++
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jan 8 2017 01:57pm
Quote (zeroRooter @ Jan 7 2017 08:11pm)
do you know c++? I think i have examples in c++


Yes I am familiar in c++, c, ruby, and crystal. You can post examples in any language really.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll