Design Pattern : Abstract Factory Question

Okay, been reviewing some design patterns. I'm going to be needing the abstract factory soon but their is one problem. I am confused on a little detail.

It consists of Abstract Factory, this makes Concrete Factory.

Their is Abstract Product, and Concrete Product.

Concrete Factory makes Concrete Product. Concrete Factory uses Abstract Product as a blueprint for the Concrete Product.

Does the Abstract Factory also create the Abstract Product? CAN Abstract Factory generate Abstract Product?

Does anyone even understand what I'm saying? :) A bit tired and if someone can shed some light I'd appreciate it.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/FryeUE
πŸ“…︎ Sep 20 2021
🚨︎ report
Abstract Factory Design Pattern youtube.com/watch?v=RDlNw…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/tracktech
πŸ“…︎ Aug 30 2021
🚨︎ report
Design patterns in Scala and Common Lisp: Abstract-Factory retro-style.software-by-m…
πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/dzecniv
πŸ“…︎ Feb 08 2021
🚨︎ report
I need some harsh criticism for the OOP example I created to introduce beginners to Object Oriented Programming. Hence is for beginners, I did not include interfaces or abstract functions nor singleton or factories. Can you give me some feedback on the code style, some possible anti patterns? Thanks gist.github.com/midorikoc…
πŸ‘︎ 24
πŸ’¬︎
πŸ‘€︎ u/mtkocak
πŸ“…︎ Jan 13 2020
🚨︎ report
Abstract Factory Pattern
πŸ‘︎ 2k
πŸ’¬︎
πŸ‘€︎ u/Vilkaz
πŸ“…︎ Apr 26 2019
🚨︎ report
Java Abstract Factory Design Pattern - C2K

Java Abstract Factory explained and with example:

Java Abstract Factory

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/connected2know
πŸ“…︎ Oct 06 2020
🚨︎ report
Design patterns in C# – Factory Method and Abstract Factory blogs.endjin.com/2019/05/…
πŸ‘︎ 77
πŸ’¬︎
πŸ‘€︎ u/dr_dimaka
πŸ“…︎ May 19 2019
🚨︎ report
Flutter Design Patterns: An overview of the Abstract Factory design pattern and its implementation in Dart and Flutter medium.com/@mkazlauskas/f…
πŸ‘︎ 16
πŸ’¬︎
πŸ‘€︎ u/mkobuolys
πŸ“…︎ Dec 27 2019
🚨︎ report
ELI5 : Design patterns, specifically factory and abstract factory patterns. stackoverflow.com/questio…
πŸ‘︎ 21
πŸ’¬︎
πŸ‘€︎ u/saurabia
πŸ“…︎ Jan 22 2019
🚨︎ report
Typesafe Abstract Factory Pattern in Scala?

Hi, I don't know how to phrase it better so please bear with me

I want to have a class that can be either in Master or Slave mode

trait Component
class MasterComponent extends Component
class SlaveComponent extends Component

and some factory to construct either a MasterComponent or SlaveComponent, master factory should only build master component and vice versa. But I'm thinking of abstracting the Master/Slave concept from Component. Hence

trait Box[+T] {
  def product: T
}
case class MasterBox[T <: Master[T]](product: T) extends Box[T]
case class SlaveBox[T <: Slave[T]](product: T) extends Box[T]

This way I can have a generic method that returns a Box[T], which can either be a master instance or slave instance at run time. But because they are both T, I can call defined on T without knowing whether they are slave or master

Now this looks similar to abstract factory pattern in Java where each factory build a specific product.

But I also want to have type safe product. Say I define a MasterComponent and a SlaveComponent, I don't want these 2 to get mixed up so I define 2 marker traits

trait MasterSlave[+T]
trait Master[+T] extends MasterSlave[T]
trait Slave[+T] extends MasterSlave[T]

With abstract factory, there is nothing stopping you from construct a SlaveComponent in a MasterBuilder. I don't know if there is any elegant way to do this in Scala?

Here is what I've come up with:

trait MasterSlave[+T]
trait Master[+T] extends MasterSlave[T]
trait Slave[+T] extends MasterSlave[T]

trait Box[+T] {
  def product: T
}
case class MasterBox[T <: Master[T]](product: T) extends Box[T]
case class SlaveBox[T <: Slave[T]](product: T) extends Box[T]

case class MasterSlaveBuilder[T, M <: T with Master[M], S <: T with Slave[S]](
                                buildMaster: () => MasterBox[M],
                                buildSlave: () => SlaveBox[S]
                           ) {
  def build(isMaster: Boolean): Box[T] = {
    if (isMaster) buildMaster() else buildSlave()
  }
}


trait Component
class MasterComponent extends Component with Master[MasterComponent]
class SlaveComponent extends Component with Slave[SlaveComponent]
class NoMasterSlaveComponent extends Component

object Building extends App {
  def master: Box[Component] = MasterBox(new MasterComponent)
  def slave: Bo
... keep reading on reddit ➑

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/junesalad
πŸ“…︎ Apr 06 2018
🚨︎ report
Java Creational Design Patterns – Abstract Factory Pattern
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Shilpa_Opencodez
πŸ“…︎ Jun 23 2019
🚨︎ report
Abstract Factory pattern used on parameterized constructors?

Say I have a parent class called class Spices , and a litany of extending child classes such as class Salt , class Pepper , class Cumin , class RedPepper , class Paprika , and so on.

I want to use java Factory pattern as a means of cleaning up the constructor code for instances of these child spices. So I use

Class cthing = Class.forName( "packagej.Paprika" );

supplying the fully qualified class name. I then

Spices spiceInstance = cthing.newInstance();

Should I expect that the invokation of the newInstance() method is going to call the appropriate constructor of Paprika?

If yes, what if Paprika only has a parameterized constructor? Do I supply those parameters to newInstance() ?

Further question, if this is correct, does this require that the parameterized constructors between all the child spices be identical in number and type?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/moschles
πŸ“…︎ Feb 12 2018
🚨︎ report
Abstract Factory design pattern help

Hello world,

I want to create a system where I can do this:

encoded_add = "a1337"
m = Message(encoded_add)
encoded_delete = "d1337"
m2 = Message(encoded_delete)

The first character of the encoded string is the type (add/delete) and the rest is the info. I want m to be AddMessage type and m2 to be DeleteMessage type. Any way to do this in Python?

Thanks

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/lanmonster
πŸ“…︎ Dec 08 2017
🚨︎ report
Is my understanding of the Abstract Factory design pattern correct?

The abstract factory is similar in terms of the form and function to the standard factory design pattern, however it shares elements with the strategy pattern as well, this allows it to use a different concrete factory for 'every' different scenario to the effect that the abstract factory has an abstract class above all other factories. Much like in other OOP designs where the concrete factories inherit the functions of the abstract class.

Or

It basically allows the creation of other objects that are then used for the creation of another object and allows the object to be created at runtime with only the specifics available and the abstract factory finds a factory to fit the requirements.

I feel like I have the broad concept and general principles of being able to create a broad range of different objects using a group of similar, however different methods (like in the strategy pattern.) But there is a link missing somewhere.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/JimboMorgue
πŸ“…︎ Oct 01 2017
🚨︎ report
The daily design pattern - Abstract factory exceptionnotfound.net/the…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/one_eyed_golfer
πŸ“…︎ Jun 06 2016
🚨︎ report
Poked this during complete beginner days. Was an attempt at abstract circle design but realised it was a bad idea once I moved my leg and noticed the skin above your calf moves around based on how you’re sitting/standing, ruining the circle pattern. Need cover up ideas!
πŸ‘︎ 21
πŸ’¬︎
πŸ‘€︎ u/sehrrdumm
πŸ“…︎ Jan 03 2022
🚨︎ report
[TOMT] [ALBUM] [UNSURE OF TIME PERIOD] Experimental psychedelic album with multi-colored cover in an abstract pattern. My memory is hilariously vague, more details in post.

Edit: Also I should mention that this is definitely an underground or indie album; certainly not the kind of thing you'd hear on the radio or anything like that.

Okay, this one might be exceptionally hard. It's an album that's definitely psychedelic/experimental psych and possibly improv/jam band, but maybe only a couple of the tracks. Although there's only like three or four tracks on the album, and I want to say it's a bit over an hour long in total.

The cover is more or less what you'd expect with that description, full of yellows, reds, greens, and a semi-consistent abstract pattern with very rough line work, almost like it's done by a child. I believe it's an instrumental album if I'm remembering correctly, and again, if memory serves, it's something of an anomaly in the band's discography. And I think the band was three members in total, but again, there's the possibility I'm wrong. I believe it's from the last ten years or so, but it could be as far back as the mid or late 90s and I honestly wouldn't be surprised.

Now's the part where you laugh at the COMICALLY sparse amount of detail here, and I'd have to laugh along with you. I'll be honest that I'm not holding out hope, but hey, this is one of my last places to ask around! I've scoured playlists both I and friends have made, I've asked them to no avail, and I've even trawled through RateYourMusic charts for variously related genres to see if I can narrow it down that way. And, well, I'm here so clearly it didn't work.

So here's hoping anyone else can help me!!!

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Dr_Death_Defy24
πŸ“…︎ Jan 13 2022
🚨︎ report
Could I make an abstract factory to merge the other factories in a game I'm working on to learn c# and object-oriented programming?

Sorry if this is the wrong place to ask. I've studied examples here and read up on factory design, factory pattern, abstract factory, & factory method; I followed a tutorial for a game that works well. But I'd like to enhance and expand it so that I can understand the fundamentals of c# and object-oriented programming. There are seven factories in the game, for example. The factories I have in-game are an item factory, a Quest factory, a recipe factory, a monster factory, a spell factory, a trader factory, and a world factory. Is it possible to implement an abstract factory that combines all the factories? I can post my code for the factories if need or would keeping them separate be best? Thank you for any assistance you may provide as well as any feedback you provide to.

πŸ‘︎ 2
πŸ’¬︎
πŸ“…︎ Dec 21 2021
🚨︎ report
What's a concrete example of when to use a Builder pattern rather than an Abstract Factory?

I'm reading "Design Patterns: Elements of Reusable Object-Oriented Software" and am confused about when to use an Abstract Factory versus a Builder pattern.

The book says: "The primary difference is that the Builder pattern focuses on constructing a complex object step-by-step. AF's emphasis is on familes of product objects."

Google says: "A Builder is a class that takes many different Objects, combines them to make one type of Object [...]. In some senses it is a Factory, but it only creates one type, most of the time"

I get this. But they're so similar to each other that I'm struggling to think of an example where I'd prefer one to the other. Can someone suggest a concrete example ("Say you have a shopping cart...") that could illustrate the drawbacks or benefits of one of these patterns?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/donkawechico
πŸ“…︎ Nov 30 2010
🚨︎ report
How do you get better at abstraction, design patterns, factories, optimizing performance?

How did you get better at implementing them into your code? I believe I understand those concepts by definition and what I can find online on articles and documentations. But when it comes to creating an application that implements all of those concepts, I am pretty clueless on what is β€œbest practice” and especially as a self taught learner without a mentor.

As an iOS dev of 2.5+ years, I can whip up a most applications but I do not think they are "best practice" or up to today's iOS standards for design patterns and multithreading. This means that most of what I do is mediocre and subpar development at best at a mid-level. (Cannot find for the life of me any full time mid-level or even junior iOS dev work at the moment so I can grow under a senior/lead ios dev)

Does anyone have any advice for getting better at these concepts such as abstraction, multithreading, design patterns, code optimization, etc?

Thank you!

πŸ‘︎ 10
πŸ’¬︎
πŸ‘€︎ u/TGIF1337
πŸ“…︎ Jul 14 2020
🚨︎ report
Showcasing the Ribbons NFT Project - generate beautiful abstract artworks over time, building with live price data as patterns emerge. ribbonsnft.io/release/YT5…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/RibbonsNFT
πŸ“…︎ Jan 14 2022
🚨︎ report
Help identifying pattern? Noritake, red font on bottom, but no pattern name/number. Black and white with gold abstract leaf. reddit.com/gallery/rxxt42
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/joe_sausage
πŸ“…︎ Jan 07 2022
🚨︎ report
Since I’m incredibly shy and haven’t came out as ENBY/Genderfluid, I’m a huge fan of this subtle ENBY wall tapestry! Most people would just see an abstract art landscape, but those in-the-know will notice the pattern.
πŸ‘︎ 110
πŸ’¬︎
πŸ‘€︎ u/Raptor22c
πŸ“…︎ Nov 18 2021
🚨︎ report
I swear I was just trying to make some abstract patterns
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/DaFrostyShock
πŸ“…︎ Dec 21 2021
🚨︎ report
11 year old son created a pattern on our Oculus and we can't get into it, is there anyway to get into it without using the pattern and avoiding a factory reset?

Our 11 year old son was playing the oculus and created some pattern on the headset that we need to input before we play it. He doesn't remember it and we can't seem to get around it. Even on the app I need it to pair with it. Is there anyway around it without a factory reset?

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/HighlyBasic69
πŸ“…︎ Jan 10 2022
🚨︎ report
My first sofirn light. The IF25. Has scratches in the reflectors straight from the factory. :( Is this normal? Will it make my beam pattern terrible?
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/PoopyMcPooper91
πŸ“…︎ Jan 14 2022
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.