LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices



Reply
 
Search this Thread
Old 04-28-2006, 12:35 AM   #46
Vagrant
Member
 
Registered: Nov 2001
Posts: 75

Rep: Reputation: 15

Java:

Pro - There is no "free"

Con - Swing sucks
The creators of Java choose Ivory Tower nonsense over proper language support. I will take an efficient and simple to use method for accomplishing a task rather than a horribly verbose high brow OO design pattern. Many times Java just proves to be heavy elitist hogwash.
 
Old 04-28-2006, 08:45 AM   #47
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Original Poster
Rep: Reputation: 46
Quote:
Hah! Learn something new every day. And that's a pretty stupid problem. I should write Java classes to test this out:
Code:
{
Class A { B b; }
Class B { A a; }
A testA = new A(); 
B testB = new B();
testA.b = testB; 
testB.a = testA;
}
... so if I understand it correctly, those two Objects would never be garbage collected because they refer to each other, even if all external references were lost?
I didn't mean to say that. Most java implementations detect cycles (as does python >2.1 and perl >4, if I recall the version numbers correctly; I do know that the newest versions do). As for the cache, as long as the caching object is referenced, the cache itself is referenced, and then the cache key is also referenced.

Quote:
If we both work in Smalltalk and your pet language is Ocaml and mine is Forth, then we both took the time to learn unusual languages in addition to the project language. That speaks well for both of us. But it still makes sense for us to use Smalltalk on all of our work projects. (I picked those programming languages because they're unusual. I don't know anything specific about any of them.)
It does speak well for us, I agree. I think, however, that Paul Graham's point is that by raising the barrier to entry, you will get better programmers; so, if by work project you mean one where we have five or ten or two hundred cow-orkers, I disagree, because then the barrier to entry has not been raised.

Quote:
Is there some place I can sign on as a henchman?
Listen to "Meme hacking for fun and profit" by Eric Raymond (on technetcast.ddj.com).

Quote:
I'm in agreement with you. There is, however, a strong faction in the Linux community that has no interest in making Linux friendly for non-technical users. They want it to remain the stomping grounds of a sort of geek elite, I suppose. That attitude baffles me.
Depending on what the make-it-friendly-for-the-newbies suggestion is about, I might agree or disagree. I think GNOME is being run by interface facists, and I prefer fluxbox for its flexibility. However, I applaud the GNOME people for being facistic about the interface, because that's what needed to create an easy-to-use interface and attract the newbies to it, and I think that GNOME should be the default desktop environment on all distros: the power users who want out of it can figure how to install fluxbox (or whatever), but the newbies might be challenged to replace KDE with GNOME.

So in conclusion, I welcome the newbies, as long as it's not on expense of me being able to get what I want.
 
Old 04-28-2006, 09:40 AM   #48
Michael_S
Member
 
Registered: Oct 2004
Location: Pennsylvania, USA
Distribution: Debian
Posts: 78

Rep: Reputation: 23
I was considering Paul Grahams's essay last night and this morning, and I want to revise my opinion. I disagree with him.

In a work environment, you need to get along with your coworkers and superiors. You need to effectively communicate the resources you need, the ideas you have, and the problems you have. You must be skilled at providing documentation and thorough testing. You must not only be able to design the software in a coherent fashion, you must be oriented towards user interface designs that are consistent with end user technical skill. You need skill at reading and modifying other people's code and offering constructive criticisms. You should be willing to at least try to teach people when you find gaps in their knowledge, and accept their instruction in turn if they find gaps in yours.

Software development for software development's sake might make you a skilled developer, but it doesn't necessarily make you a valuable employee. It's only part of the picture, and it is not sufficient by itself.

For example, I tend to have a problem with poorly organized code. If I don't like the way an app is designed, my first inclination is to scrap it and rewrite it from scratch. I think it's fun. But unless the application in question is flat out unusable, my employer has a much better use for me.
 
Old 04-28-2006, 10:56 AM   #49
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Unrelated, but I found this picture with Tux and Duke fighting side by side and thought it was cool to brake the ice here

http://www.miamisburg.com/dukeTuxJavaOne2003TShirt.jpg
 
Old 04-28-2006, 12:51 PM   #50
Vagrant
Member
 
Registered: Nov 2001
Posts: 75

Rep: Reputation: 15
Quote:
Originally Posted by Michael_S
I was considering Paul Grahams's essay last night and this morning, and I want to revise my opinion. I disagree with him.

In a work environment, you need to get along with your coworkers and superiors. You need to effectively communicate the resources you need, the ideas you have, and the problems you have. You must be skilled at providing documentation and thorough testing. You must not only be able to design the software in a coherent fashion, you must be oriented towards user interface designs that are consistent with end user technical skill. You need skill at reading and modifying other people's code and offering constructive criticisms. You should be willing to at least try to teach people when you find gaps in their knowledge, and accept their instruction in turn if they find gaps in yours.

Software development for software development's sake might make you a skilled developer, but it doesn't necessarily make you a valuable employee. It's only part of the picture, and it is not sufficient by itself.

For example, I tend to have a problem with poorly organized code. If I don't like the way an app is designed, my first inclination is to scrap it and rewrite it from scratch. I think it's fun. But unless the application in question is flat out unusable, my employer has a much better use for me.
I can understand that. But isn't there a danger, in that sort of attitude, of becoming a slavish corporate tool?
 
Old 04-28-2006, 02:09 PM   #51
Michael_S
Member
 
Registered: Oct 2004
Location: Pennsylvania, USA
Distribution: Debian
Posts: 78

Rep: Reputation: 23
Quote:
Originally Posted by Vagrant
I can understand that. But isn't there a danger, in that sort of attitude, of becoming a slavish corporate tool?
What a pleasant way to phrase the question.

A business software developer's ultimate goal is the creation of applications that enable the target user to accomplish their tasks quickly and easily. You don't need to become a soulless corporate automaton in order to keep that in mind.

I think complete emphasis on pure hacking ability is wrong. Here's a silly example. I am working on extra features for the Gnu Image Manipulation Program, and I decide to hire a helper. I intend to make money with support and training on the new features.

I hire a world class software engineer, best I can find at software development. He starts the job, and decides that my chosen revision control system (CVS, SubVersion, darcs, whatever) is inadequate and spends all of his working hours developing a superior alternative. That's great for the world at large, but I'm out of business.

Or, he decides that the GIMP should really be written in Python and starts from scratch. In five years, he will present a revised GIMP rebuilt from the ground up that blows the existing one out of the water. Only I can't pay him for five years without any salable services.

Or, he starts adding a whole mess of really nifty features but decides that GUI work sucks and has them governed by a series of intricate configuration files and a custom scripting language. He's made the GIMP dramatically more feature rich, but done nothing to make it user friendly. I can't sell support or training, I'm sunk.

Or, he starts profiling GIMP's performance and realizes that a lot of the bottlenecks come from unoptimized code in the GCC (Gimp is written in C, isn't it?) So he spends all of his time working on fancy compiler optimizations for the GCC.

Again, this is great for the community at large but it does not fit my reason for hiring him. At the best it's foolish lack of consideration, at the worst it's dishonest. Programming for programming's sake is awesome, but being good at that does not necessarily make you a good choice for an employee.

What I would really need in an employee is someone willing to work with me on improving GIMP in a user friendly fashion. I need to find the brightest software engineer that will work within that constraint. I hate to use the term "team player" because it smacks of the same vague corporate nonsense as "thinking outside the box" and "leveraging your resources", but team play is important.

Last edited by Michael_S; 04-28-2006 at 02:10 PM.
 
Old 04-28-2006, 05:34 PM   #52
Vagrant
Member
 
Registered: Nov 2001
Posts: 75

Rep: Reputation: 15
Michael_S, I agree with your basic point, surely. However, I do think there is a danger that this way of thinking could lead one to become an mindless automaton.
 
Old 05-05-2006, 07:45 PM   #53
NetRAVEN5000
Member
 
Registered: May 2005
Distribution: Ubuntu 9.04
Posts: 320

Rep: Reputation: 30
Before you ridicule Java, you have to realize that it wasn't meant to be every programmer's dream so much as it was meant to be a language that could work on any device (which is why it's on so many cellphones and MP3 players and stuff).

Object-oriented programming has benefits over other forms of programming -- in fact, some of the main concepts of OOP are so useful that they have been implemented into C++.

The structure of things is, IMO, great for debugging programs. It'll tell you exactly what happened - what class caused the problem, what line, what linking class caused the problem. . .

Java may prevent you from doing what you're trying to do, but not really. There are certainly ways to circumvent it if you know what you're doing. And a big reason why they made this hard to do, is that Java's a powerful language, and they don't want it to be easy to make viruses and that sort of thing. Or to make it easy for a Java app to be injected with a virus.

I don't know where you're getting your facts from, but "a*x*x + b*x + c" is perfectly legal syntax in Java.

About your code:
Code:
static void fail(String msg) {
    System.out.println(msg);
    System.exit(1);
}
it's all perfectly legal code. If it's whining about anything, it's probably whining about the fact that you didn't declare the function to be "public", "private", or "protected", or whatever. It wouldn't be whining about a return type because you do, in fact, have a return type: "void".

And according to this article, Java CAN do multiple inheritance, it's just a little awkward. Which IMO is fine since you rarely ever need it.
 
Old 05-06-2006, 03:33 AM   #54
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by NetRAVEN5000
Before you ridicule Java, you have to realize that it wasn't meant to be every programmer's dream so much as it was meant to be a language that could work on any device (which is why it's on so many cellphones and MP3 players and stuff).
I'm not expecting it to be everybody's dream. In fact, I'm pointing out exactly why it's not my dream programming language.

Quote:
Object-oriented programming has benefits over other forms of programming -- in fact, some of the main concepts of OOP are so useful that they have been implemented into C++.
So has aspect-oriented, functional, contractual and logical. It's all about using the right tool for the right job. You can also write object-oriented code in C (see above reference to gtk).

I'm not saying that OOP is bad per se, I'm just saying that there are some problems best solved with something else.

Quote:
The structure of things is, IMO, great for debugging programs. It'll tell you exactly what happened - what class caused the problem, what line, what linking class caused the problem. . .
Which is different from getting a backtrace from python or gdb exactly how? In my experience, most backtraces in java start with something fairly far removed from the cause of the bug, compared to python or C, because you have to jump through a lot of hoops in java (oh, so this class is logically a subclass of these two classes and forwards the calls... and this one encapsulates some mimimal operation...).

Quote:
Java may prevent you from doing what you're trying to do, but not really.
You're right: it's turing-complete.

Quote:
There are certainly ways to circumvent it if you know what you're doing. And a big reason why they made this hard to do, is that Java's a powerful language, and they don't want it to be easy to make viruses and that sort of thing.
I call bullshit on that. I don't know how hard it is to write viruses, but unless you have a quote from the designers of the language to show for it, I'm not going to believe that's the purpose.

Quote:
Or to make it easy for a Java app to be injected with a virus.
I think the designers aimed to avoid buffer overruns and heap corruption (which, I'll give you that, are the reason for many exploits). I don't know if that was explicitly to prevent viruses, or just to prevent hard-to-debug bugs.

Quote:
I don't know where you're getting your facts from, but "a*x*x + b*x + c" is perfectly legal syntax in Java.
Not if the operands are class instances, which was my point.

Quote:
About your code:
Code:
static void fail(String msg) {
    System.out.println(msg);
    System.exit(1);
}
it's all perfectly legal code.
If it's whining about anything, it's probably whining about the fact that you didn't declare the function to be "public", "private", or "protected", or whatever. It wouldn't be whining about a return type because you do, in fact, have a return type: "void".
Yeah, I forgot a privacy specifier. Pick one, it doesn't matter. My issue is that I've gotten compiler errors (with `error' spelled W-A-R-N-I-N-G) saying I didn't have a return statement.

Quote:
And according to this article, Java CAN do multiple inheritance, it's just a little awkward. Which IMO is fine since you rarely ever need it.
No, it emphatically can't do multiple inheritance; the article just shows you how you can achieve more or less the same semantics. My problem with that method is that you end up shaping your code unnaturally, compared to if you had multiple inheritance.

Regards --Jonas

Last edited by jonaskoelker; 05-08-2006 at 05:23 PM.
 
Old 05-08-2006, 09:57 AM   #55
Michael_S
Member
 
Registered: Oct 2004
Location: Pennsylvania, USA
Distribution: Debian
Posts: 78

Rep: Reputation: 23
Quote:
Originally Posted by jonaskoelker
Which is different from getting a backtrace from python or gdb exactly how? In my experience, most backtraces in java start with something fairly far removed from the cause of the bug, compared to python or C, because you have to jump through a lot of hoops in java (oh, so this class is logically a subclass of these two classes and forwards the calls... and this one encapsulates some mimimal operation...).
I don't know about a Python backtrace, but you actually have to run gdb to get the trace in that. With Java, you get the full exception chain (including the originating method) every time. That's really handy for debugging problems that only appear on a PC running your software on the other side of the continent or across an ocean. "Please email me the error log."

I think the verbose error messages are one of Java's greatest strengths. And the Apache logging API (which is available for a large number of computer languages, not just Java) is spectacularly handy.

Quote:
No, it emphatically can't do multiple inheritance; the article just shows you how you can achieve more or less the same semantics. My problem with that method is that you end up shaping your code unnaturally, compared to if you had multiple inheritance.
Java was specifically designed not to support multiple inheritance because of conflicts. Just like you can't do pointer arithmetic or garbage collection, you can't have:
class A { private int count; add_foo() {count++;} }
class B { private int count; add_bar() {count++;} }
class C extends A, B { .... }
Because then calling C.add_foo() might mess up the instance data in B.

When you need multiple inheritance, its absence IS a real problem for Java. But the Java designers (Gosling, et al) decided it was worth omitting.

-Mike

Last edited by Michael_S; 05-08-2006 at 09:58 AM.
 
Old 05-08-2006, 01:37 PM   #56
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
Yeah, which means that debugging info is in every single java bytecode. When you compile C, you can choose not to have the debugging cruft for release builds. You still have to run a debugger to find out what was going on when it crashed. Even though a backtrace is infinitely useful, I still need a debugger to know what is contained in my variables.

Collisions are not a problem in multiple inheritance. Here is some multiple inheritance in C(and in C++ too)
Code:
struct foo
{
   int qux;
};
struct bar
{
   int qux;
};
struct baz
{
   struct foo foo;
   struct bar bar;
};
No collision, just access the one you want with baz.foo.qux and baz.bar.qux.
 
Old 05-08-2006, 04:04 PM   #57
NetRAVEN5000
Member
 
Registered: May 2005
Distribution: Ubuntu 9.04
Posts: 320

Rep: Reputation: 30
Quote:
Originally Posted by jonaskoelker
Which is different from getting a backtrace from python or gdb exactly how? In my experience, most backtraces in java start with something fairly far removed from the cause of the bug, compared to python or C, because you have to jump through a lot of hoops in java (oh, so this class is logically a subclass of these two classes and forwards the calls... and this one encapsulates some mimimal operation...).
It's different in that you don't have to run a separate program - it has an error, it'll spit out a backtrace at you. Most users will then say "hey, when I do this it tells me this" and right away you'll at least know where the error occurred, and maybe have some idea what the user did to cause the error, and then from this you can figure out what went wrong.

I don't know about most of the users here, but when something goes wrong in a program (admittedly an infrequent occurrence in Linux, for me anyways) the first thing I do is NOT to run gdb. It's to either just not do anything, come here looking for help (if it's really a problem for me), or, if it gives me an error message, tell that to the developers.

Most (or at least a good portion of) users don't know or care how to use gdb. If there's a bug in your program, and you want to know what it is so you can fix it, you'll have to give them something to go by rather than just depending on them to (a) know how to use gdb and (b) care enough to run a backtrace. You've gotta throw them a frickin' bone - you can't just expect that they know how to debug your program.

The two best examples of good ways to do this that I can think of off-hand are the way FireFox comes up with that "Mozilla User Agent" when it crashes, and the way LimeWire gives you all the bug information (looks kinda like the backtrace you normally see in the terminal when Java apps crash) and the option to send the bug info to the developers.
You don't really have to go that far, though, if you don't want to take the time, but you really should have at least something so the user can say "it said this when it crashed" and you'll get at least somewhat of an idea what went wrong.
 
Old 05-08-2006, 05:20 PM   #58
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Those are all good points and all, but this is something Java developers can do that no C++/python programmer can:

http://youtube.com/watch?v=BXHE4SktsbM
 
Old 05-08-2006, 06:22 PM   #59
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by NetRAVEN5000
It's different in that you don't have to run a separate program (...). I don't know about most of the users here, but when something goes wrong in a program (admittedly an infrequent occurrence in Linux, for me anyways) the first thing I do is NOT to run gdb. (...) Most (or at least a good portion of) users don't know or care how to use gdb.
Okay, you're making a good point there. Under the assumption that all involved parties are coders, it a little more time-consuming starting up gdb, but that's about it (I'd guess python is equivalent, then; try $ python -c "def f():f()"$'\n'"f()").

However, that's a patently false assumption in most cases. So yeah, you're right, it is great not to have to invoke gdb and count on the users knowing how to use it. I've seen enough (that is, one or more) backtraces from binaries without debugging symbols, so you do have a very valid point.

Quote:
The two best examples of good ways to do this that I can think of off-hand are the way FireFox comes up with that "Mozilla User Agent" when it crashes, and the way LimeWire gives you all the bug information (looks kinda like the backtrace you normally see in the terminal when Java apps crash) and the option to send the bug info to the developers.
Hah. Funny how your examples are not free (libre) software (firefox itself is, but firefox with the bug thingy is, AIUI, not--at least the debian firefox doesn't seem to have it). Not that it makes the examples any less valid in and of itself, I just can't comment on them.

To tuxdev: no, that code is not multiple inheritance. Here's multiple inheritance:
Code:
struct foo {int i;};
struct bar {int i;};
struct baz: public foo, public baz:
{void f() {++foo::i;}};
To Michael_S: have a look at how C++ does multiple inheritance. Then have a look at how python does it. Pay close attention to the pragmatic but disgusting name mangling hacks available in python (basically, if your member's name starts with a single underscore, its name gets mangled and unmangled--as appropriate--such that it really contains the class name as well).

Quote:
When you need multiple inheritance, its absence IS a real problem for Java. But the Java designers (Gosling, et al) decided it was worth omitting.
M-hmm.. and I disagree with them. Otherwise, I wouldn't have written the post in the first place
 
Old 05-08-2006, 07:24 PM   #60
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
NetRAVEN5000: The best way for users to help with dev is to submit bugs through bugzilla. A stack trace really doesn't help anybody but the developer who is working on the bug. The developer surely knows how to use gdb, and the bug must be consistently reproducible to have any chance to be fixed.

jonaskoelker: Your code isn't legal C code. My code is how to do multiple inheritance in C, similar to when C++ was CFront.
 
  


Reply

Tags
article, java


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hate it....... sgrayban Conectiva 9 04-30-2005 06:24 PM
I hate it when... Tarts General 27 10-20-2003 05:32 PM
I hate to ask this but... TippyToes General 16 08-24-2003 08:23 PM
I hate it linuxdoesntwork Linux - Newbie 3 06-29-2003 05:05 PM
i hate this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Jeffrey General 5 04-06-2001 02:04 AM


All times are GMT -5. The time now is 12:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration