4 ms·
>It’s obscuring the purpose of the code–replacing a two or three line utility (max!) with dozens or even hundreds of lines of self-important masturbatory Java b
by endtime 16y ago
>It’s obscuring the purpose of the code–replacing a two or three line utility (max!) with dozens or even hundreds of lines of self-important masturbatory Java bullshit.
I'm not trying to troll, but are there any Java programmers who don't write code like this? I've never seen "real" Java code, which is to say production code, but every time I had to work with Java in school it was pretty much described by the above quote; and what's more, the libraries I had to interact with often made me feel like I was forced to do the same thing.
- coliveira 16y agoThat is the big problem of Java: the libraries. They require programmers to use these patterns, even when it makes no sense.
- giberson 16y agoLibraries don't require you to use them. You are free write your own solution [that makes sense].
- steveklabnik 16y agoAnd also making it really easy to say "bye bye" and move to a language that has sane libraries.
- meadowsp 16y agoCould you point me towards a comparison of an insane java library and the sane equivalent in a different language?
- steveklabnik 16y agoHello world in Swing: (from here: http://www.java2s.com/Code/Java/Swing-JFC/HelloWorldSwing.htm http://www.java2s.com/Code/Java/Swing-JFC/HelloWorldSwing.ht... ) import javax.swing.JFrame; import javax.swing.JLabel; public class HelloWorldSwing { public static void main(String[] args) { JFrame frame = new JFrame("HelloWorldSwing"); final JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } } Hello world in Shoes: Shoes.app do para "Hello, world" end Hello world for Hibernate: (from here: http://www.javaworld.com/javaworld/jw-10-2004/jw-1018-hibernate.html http://www.javaworld.com/javaworld/jw-10-2004/jw-1018-hibern...) package hello; public class Message { private Long id; private String text; private Message nextMessage; private Message() {} public Message(String text) { this.text = text; } public Long getId() { return id; } private void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Message getNextMessage() { return nextMessage; } public void setNextMessage(Message nextMessage) { this.nextMessage = nextMessage; } } Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); Message message = new Message("Hello World"); session.save(message); tx.commit(); session.close(); The equivalent in ActiveRecord: class Message < ActiveRecord::Base end message = Message.new(:text => "Hello, world") message.save You have to set up your schema in both, so I've left that out. These are just the first two that came to my head. I ditched Java so long ago that I'm sure a few hundred more have come up.