Thread: Object Oriented Design Principles

Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24
  1. #21  
    Member Object Oriented Design Principles Market Banned

    thesharp's Avatar
    Join Date
    Dec 2010
    Age
    32
    Posts
    1,118
    Thanks given
    311
    Thanks received
    140
    Rep Power
    312
    Seen about 10 of them in college, going to read the ones I don't know yet.
    Personally, I'd like it if more people started using uml diagrams in their snippets/tutorials instead of just copy and paste code. It would help the programmers who are implementing the tutorial/snippet more to understand how it works and they would actually learn something instead of leeching


    Reply With Quote  
     

  2. #22  
    Extreme Donator

    Dylan's Avatar
    Join Date
    Jan 2008
    Posts
    399
    Thanks given
    31
    Thanks received
    10
    Rep Power
    366
    Would hyperion's PacketManager be a factory method pattern?
    Reply With Quote  
     

  3. #23  
    Registered Member

    Join Date
    Jun 2007
    Posts
    2,237
    Thanks given
    267
    Thanks received
    411
    Rep Power
    1283
    Quote Originally Posted by Dylan View Post
    Would hyperion's PacketManager be a factory method pattern?
    No, because you're not creating objects, you're just hiding and restricting access to the arrays by using:

    Code:
     public void handle(IoSession session, Packet packet) {
                    try {
                            packetHandlers[packet.getOpcode()].handle((Player) session.getAttribute("player"), packet);
                    } catch(Exception ex) {
                            logger.log(Level.SEVERE, "Exception handling packet.", ex);
                            session.close(false);
                    }
            }
    If the code looked something like:

    Code:
    public PacketHandler handle(IoSession session, Packet packet)    {
        switch(packet.getOpcode())    {
            case 0:
                return new ....//whatever here.
            case 1:
                return new....// and again
        }
        throw new IllegalArgumentException();
    }
    And so on, then it would be a factory pattern method.
    Don't worry, Be happy.
    Reply With Quote  
     

  4. #24  
    Registered Member
    Join Date
    Feb 2007
    Posts
    30
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    Design Patterns eBook

    This book helped me so much while learning design patterns, so I can't help but suggest it to anyone that wants to learn more. It's explained extemely simple, and it's a fun read. I bought it because I wanted to support the people behind it, but you can get it by other means of course.
    Reply With Quote  
     

Page 3 of 3 FirstFirst 123

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 176
    Last Post: 06-02-2011, 02:41 AM
  2. 3D Design
    By Snow Cat123 in forum Chat
    Replies: 4
    Last Post: 06-27-2010, 06:52 AM
  3. Object Oriented Commands
    By meiscooldude in forum Tutorials
    Replies: 24
    Last Post: 03-11-2009, 12:17 AM
  4. My sig design
    By Grep in forum Showcase
    Replies: 2
    Last Post: 04-10-2008, 01:36 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •