Home System Verilog Interview Questions SV What is factory pattern
Main Menu
Home
System Verilog
    - Constructs
    - SV Classes
    - Functional Coverage SV
    - Examples
    - Tools
    - Links
    - Books
    - Interview Questions SV
        -- What is callback
        -- What is factory pattern
        -- Logic Reg wire
        -- Need Clocking Block
        -- Ways to avoid race
        -- Coverage Questions
        -- OOP
        -- Need of virtual interface
        -- abstract class
        -- Part 1
        -- Part 2
Verilog
Methodologies
Open Vera
Digital Concepts
Verification Basics
Protocols
Scripting
Articles
Videos
Interview Questions
Computer Architechture
C and C++
Blog/Article
AsicGuru Blog
Tags Cloud
Ads
Usefull Sites
Know Your IP/Location
Local Information India
Buy Car/Inverter Batteries
Real Estate India
Sports Accessories India
What is factory pattern
Share This Articale:

Factory Pattern Concept : 

Methodologies like OVM and VMM make heavy use of the factory concept. The factory method pattern is an object-oriented design pattern. Like other creational patterns, it deals with the problem of creating objects (products) without specifying the exact class of object that will be created. The factory method design pattern handles this problem by defining a separate method for creating the objects, whose subclasses can then override to specify the derived type of product that will be created. More generally, the term factory method is often used to refer to any method whose main purpose is creation of objects.

Or in simple terms factory pattern help in creation of the object when you dont know the exact type of the object. the normal way of creating the object is :

// Normal Type based object creation

// Class object
class my_class;
   int i;
endclass 

program main;
   // Create object type my_class
   my_class obj1; 
   obj1 = new
endprogram

// Using Factory I should be able to do the following

program main;
   base_class my_class_object; 
   
   base_class = factory.create_object("my_class"); // See here the type of the object to be created is passed as a string so we dont know the exact type of the object
endprogram

 //Now lets see how it works in system verilog example : TO BE ADDED 
Keywords : Factory   Pattern  

This Articles is written/submitted by puneet (Puneet Aggarwal). You can also contribute to Asicguru.com. Click here to start


Prev << What is callback

Next >> Logic Reg wire

 
Login/Register
Register
Sign In
Login with :-
gmail-yahoo-twitter-facebook
| | |  
  •  
  • Bookmark
    ADS