Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Hello, world

Name: Anonymous 2014-01-07 4:03

I was amused at some of the archetypal "Hello Worlds" for various Java frameworks. For reference, I'll include an assembly version first:


; This program displays "Hello, World!" in a windows messagebox and then quits.
;
; Written by Stewart Moss - May 2006
;
; Assemble using TASM 5.0 and TLINK32
;
; The output EXE is standard 4096 bytes long.
; It is possible to produce really small windows PE exe files, but that
; is outside of the scope of this demo.

.486p
.model flat,STDCALL
include win32.inc

extrn MessageBoxA:PROC
extrn ExitProcess:PROC

.data

HelloWorld db "Hello, world!",0
msgTitle db "Hello world program",0

.code
Start:
push MB_ICONQUESTION + MB_APPLMODAL + MB_OK
push offset msgTitle
push offset HelloWorld
push 0
call MessageBoxA

push 0
call ExitProcess
ends
end Start


Now, Java's Swing framework:


import javax.swing.JFrame; //Importing class JFrame
import javax.swing.JLabel; //Importing class JLabel
public class HelloWorld {
public static void main(String[] args) {
JFrame frame = new JFrame(); //Creating frame
frame.setTitle("Hi!"); //Setting title frame
frame.add(new JLabel("Hello, world!"));//Adding text to frame
frame.pack(); //Setting size to smallest
frame.setLocationRelativeTo(null); //Centering frame
frame.setVisible(true); //Showing frame
}
}


And my favorite, the very poorly-named tinystruct 2.0:


package tinystruct.examples;

import org.tinystruct.AbstractApplication;
import org.tinystruct.Application;
import org.tinystruct.ApplicationException;
import org.tinystruct.system.ApplicationManager;

public class hello extends AbstractApplication {

@Override
public void init() {
// TODO Auto-generated method stub
this.setAction("say", "say");
}

@Override
public String version() {
// TODO Auto-generated method stub
return null;
}

public String say(String words){
System.out.println(words);
return "<h1>"+words+"</h1>";
}

/**
* @param args
* @throws ApplicationException
*/
public static void main(String[] args) throws ApplicationException {
// TODO Auto-generated method stub
// Praise to the Lord!
ApplicationManager.install(new hello());

// to print 'Hello World'
ApplicationManager.call("say/Hello World", null); // Hello World

// or...
Application app=ApplicationManager.get( hello.class.getName());
app.invoke("say", new Object[]{"<h1>Hello, World!</h1>"}); // <h1>Hello, World!</h1>
app.invoke("say", new Object[]{"<h2>Bye!</h2>"}); // <h2>Bye!</h2>

// or...
// http://localhost:8080/?q=say/Hello World
// https://github.com/m0ver/tinystruct2.0
}

}


So there you have it: Java is so bloated that it can actually take more lines of code to do something than it would in x86 assembly. I guess eventually in theory it would pay off, but why the fuck does anyone use this language? I feel like it's some kind of joke.

Name: Anonymous 2014-01-07 4:49

enterprise quality

Name: Anonymous 2014-01-07 5:00

>>2
Trying to fit in.

Name: Anonymous 2014-01-07 11:12

You think you're tough hugh ?
I am a professional programmer developing SCALABLE .NET CLOUD-BASED SINGLE-PAGE WEB APPLICATIONS and I am very serious.
Java is the only choice for the ENTERPRISE because its FORCED OBJECT-ORIENTATION allows the full development of BUSINESS OBJECTS.
Are you cloud-ready ?
Are you OOP-zealotry-happy ?
Are you writing SINGLE-PAGE WEB APPS using hipstr.js and other high-end technologies ?
I think not.

SINGLE-PAGE WEB APPS are the summum of technological development. Designed languages you say ? I don't need them. SINGLE-PAGE WEB APPS offer an incoherent, nonsensical, inefficient accretion of various unrelated software technologies, and as such this provides them such SCALABILITY that they are here to stay.

ok just trolling

Name: Anonymous 2014-01-07 12:31

>>3
Probably the same guy who posts under the ``VIPPER'' nickname

Name: Anonymous 2014-01-07 12:46

I can't tell if I'm being ignorant or not, but there's something that bothers me in people that take pride in familiarity with enterprise frameworks.

https://boards.4chan.org/g/res/39373676

Name: Anonymous 2014-01-07 13:46

>>6
It's all about the resume.

And JOptionPane.showMessageDialog(...) aside, comparing languages on this basis is rather silly, because the language in question isn't really being used* - just the calling interface to a few functions in a library or such. Representative samples are fine, but at some point of triviality they stop being useful. For example, the equivalent in HQ9 (or CHIQRSX9+ for the ambitious among you) is just

H

, which is about as terse as you can get without resorting to languages that are made up on the spot, but I don't think any of you would take that as a serious argument in favor of the language.

IHNBT, this smells too much like pasta

* No mathematical operations, no flow control, no declaration of functions, in fact nothing I would call a variable at all besides a few spurious constructors on the Java side. I'd much prefer to see fizzbuzz or a couple of different-styled implementations of fib(n)

Name: Anonymous 2014-01-07 14:19

>>1,6
Why has that been reposted on /g/?

Name: >>1 2014-01-07 16:32

>>8
You mean this thread? The /g/ thread is 404'd now, but I didn't post it there.

>>7
That's kind of my point. If a framework is so bloated that you can't implement Hello, World without (something like) 26 lines of code, then other seemingly trivial tasks will probably encounter unnecessary stupidity. I mean, look at the empty overrides that MUST be put in there for no particular reason. A large percentage of classes will just have empty overrides sitting there. That kind of idiocy just makes me sick. YAGNI, to quote myself from five years ago.

The other thing is that Java itself is not actually that bad. It's the frameworks and the culture of making a new class for every fucking line of code that makes it unusable. There's a real intellectual and maintenance cost to burying a few lines of real functionality in three pages of cruft.

Name: VIPPER 2014-01-07 23:34

>>5
But I am not

Name: Anonymous 2014-01-08 12:59

>>9
Well, clearly there's a pro/g/enitor amongst our ranks.

Name: Anonymous 2014-01-08 19:17

LISP (just the ending):


)))))))))))))))))))))))))))))))))))))))))))))))))

Name: Anonymous 2014-01-08 21:12

Granted, the Java Swing code is doing more than displaying Hello World on a console; namely drawing a window, displaying the message, and centering it on the window.
As far as building GUI programatically goes, it could be considerably [b]larger[\b].

Name: Anonymous 2014-01-08 21:18

>>13
I don't do Windows programming, but I'm pretty sure the asm does that as well.

Name: Anonymous 2014-01-08 21:35

>>14
Oh, it totally does, I didn't even read it past a quick glance, how embarrassing.

Name: Anonymous 2014-01-09 19:03

>>12
Did the beginning get garbage collected?

GC is shit.

Name: Anonymous 2014-01-14 7:59

Windows 9 will introduce new API functions, which will make native Win32 Hello World program much more elegant:


#include <windows.h>
int main() {
return DisplayHelloWorldEx(NULL, NULL, NULL, HW_DEFAULT, FALSE, NULL, NULL);
}

Name: Anonymous 2014-01-14 14:30

>>17
Fuer dem lulz, ja?

Name: Anonymous 2014-01-15 0:06

>>18
NEIN

Name: Anonymous 2014-02-10 6:30

I think tinystruct 2.0 would work in different devices.

Don't change these.
Name: Email:
Entire Thread Thread List