Metasploit uses Facade design pattern which encapsulates/simplifies the complex part of the framework by implementing it as interfaces which makes development really easy and elegant. I found that the Wikipedia example of facades is descent to be presented
# Complex Parts | Computer framework classCPUdeffreeze;enddefjump(position);enddefexecute;endendclassMemorydefload(position, data);endendclassHardDrivedefread(lba, size);endend# Facade | InterfaceclassComputerFacadedefinitialize @processor =CPU.new @ram =Memory.new @hd =HardDrive.newenddefstart @processor.freeze @ram.load(BOOT_ADDRESS, @hd.read(BOOT_SECTOR,SECTOR_SIZE)) @processor.jump(BOOT_ADDRESS) @processor.executeendend# Client (The Developer want to use the complex computer framework)computer_facade =ComputerFacade.newcomputer_facade.start
As you can see from the above code, the developer who wants to use the Computer framework don't have to deal with the complex codebase (classes, methods and calculations) directly. Instead, he will use a simple interface class called ComputerFacade which instantiate(as objects) all classes once you call it.
Another exist example in ruby language itself is open-uri standard library, which encapsulates net/http and uri libraries and makes theme looks like opening ordinary file. To see how open-uri makes things easy, We'll write a code that send get request to Ruby.net and get the response with both regular and open-uri way
As you can see in figure above, Metasploit libraries are working as interface serves all modules, interfaces, tools and plugins. That's exactly represents what we've explained in Code Design Pattern.