class WriterFactory defm get_writer(writer_name) if writer_name == 'file' return new FileWriter() elseif writer_name == 'console' return new ConsoleWriter() elseif writer_name == 'buffer' return new BufferWriter() else return new BufferWriter() end end end