LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-10-2006, 05:44 PM   #76
NetRAVEN5000
Member
 
Registered: May 2005
Distribution: Ubuntu 9.04
Posts: 320

Rep: Reputation: 30

tuxdev, I'm not sure you understand what I'm saying. . .

When you (a collective "you" meaning your fellow programmers also) write code "you" understand what it's doing.

You can create a set of test data that will test every single if-statement and for-loop. If the test data causes incorrect results, you can go back through your code and figure out where the problem is.

You can also go in the reverse direction - look at the incorrect results and the problematic line (or at least what the trace program considers to be the problematic line) and figure out what the input that caused the problem was - or at least what input might cause the same problem.

It's harder to do than if you're given the data that causes the problem, I'll admit that. But it can be done. Otherwise, how do you think people who write accounting software fix bugs? Certainly many users wouldn't feel comfortable giving away their account information!
 
Old 05-10-2006, 06:05 PM   #77
llmmix
Member
 
Registered: Jun 2005
Posts: 73

Rep: Reputation: 15
I don't agree, because i haven't learned java yet.
 
Old 05-19-2006, 02:56 PM   #78
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Today I am officially upset with Java. I've been trying to develop a few Web applications using some frameworks as Stripes and Struts and all my hope believing that JEE was good is gone... In fact, I've not yet created a class in Java myself. I've just overrided a few methods and most of my week was spent configuring pointless XML files. And even with all the time I've spent with it, I still can't get it right. It goes as simple as importing the wrong tag libraries up to mysterious problems found under run-time.

Java is also so strong typed that using it together with a database becomes a pain. I waste more time doing casts than anything else to convert datatypes. But there's yet another solution... a framework. After wasting more time configuring Hibernate XML configuration files, I could map my classes against a SQL table. What waste of time. I don't know who it's to blame here: Sun for loving XML or the Framework developers for making things more complicated than they should. It is simply impossible to use Java at the level I'm using without an IDE as Eclipse WTP or BEA workshop. And even though, I face a lot of problems following books, framework configurations _and_ making it all to work together with Eclipse WTP.

No matter how much I comment, when I few days has passed, it is difficult to understand my own code. Leave it alone working with a group.

I think I will take another look at my dusty C++ books and check python.org again. And I think it's time to change course as well... Maybe Unix system administration or something...

Last edited by Mega Man X; 05-19-2006 at 02:58 PM.
 
Old 05-20-2006, 10:00 PM   #79
Michael_S
Member
 
Registered: Oct 2004
Location: Pennsylvania, USA
Distribution: Debian
Posts: 78

Rep: Reputation: 23
Mega Man X,

I had an edge. My first work with Java was maintaining and extending a Java Struts/Hibernate/PostgreSQL application. So I had everything working already and a metric ton of existing classes, JSP pages, Hibernate files, and so forth for reference when I needed to create something new.

I can do a lot of moderately extensive changes quickly now. But I don't have any experience in Python or PHP and I've never used Perl for anything this big. So I couldn't say whether it's easier or harder than it would be with a good implementation of the project in those languages.

[EDIT] The code I'm reading and the new code I'm creating is extremely easy to read. That's the single most convenient piece of the setup.

Last edited by Michael_S; 05-20-2006 at 10:06 PM.
 
Old 05-21-2006, 01:18 AM   #80
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
Thanks for your positive feedback Michael_S. It's good to hear that Struts/Hibernate work and is easy to configure. I maybe haven't got the hang of it yet. Do you know of any good tutorials on the net? My Struts book is useless and it feels like every tutorial I found is for Struts 1.1 and many things has become deprecated
 
Old 05-22-2006, 09:21 AM   #81
Michael_S
Member
 
Registered: Oct 2004
Location: Pennsylvania, USA
Distribution: Debian
Posts: 78

Rep: Reputation: 23
Quote:
Originally Posted by Mega Man X
Thanks for your positive feedback Michael_S. It's good to hear that Struts/Hibernate work and is easy to configure. I maybe haven't got the hang of it yet. Do you know of any good tutorials on the net? My Struts book is useless and it feels like every tutorial I found is for Struts 1.1 and many things has become deprecated
Unfortunately, the app I'm using is built on Struts 1.1 and it uses a lot of features that became deprecated in newer versions. So I can't point you to anything newer for learning and reference.

And again, I can all but guarantee I would be in the same situation you are in if I had been building an application from scratch. I was just very lucky to begin my work on a fully featured, functional Struts application.

Last edited by Michael_S; 05-22-2006 at 09:23 AM.
 
Old 06-01-2006, 11:33 AM   #82
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
Thumbs up

Quote:
Originally Posted by jonaskoelker
Hello everyone.
Jonas, your post brought tears of joy to my eyes. I will read it in more detail and hopefully have something to bash along with you. In the meantime, before I found out about your thread, I had already made a few comments here: http://www.linuxquestions.org/questi...d.php?t=449782

Cheers,
Rand
 
Old 06-02-2006, 02:32 PM   #83
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Having been alerted to this debate from a programming thread I arrive fairly late...

There are a number of points that I disagree with.

There ware some suggestions that C supports object orientation. That is plainly wrong and the code example that tuxdev gave was not inheritance (let alone multiple inheritance) but association.

The debate about a trace was good but it missed the scenario of where there is no user to report the steps that caused the system to fail. A trace is an invaluable tool when debugging batch processes. Additionally, the overhead to generating a trace is minimal because all the information is on the program stack anyway, it just requires to be interpreted at the moment of the error, which is (presumably) done by the JVM, thus not adding anything to the bytecode as suggested by tuxdev.

Quote:
Originally Posted by jonaskoelker
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.
I'd suggest that you look at the section on Secure from this document from Sun. Viruses and restricting them was something that they thought about when designing the language, which is a positive thing but it comes with a price.
 
Old 06-02-2006, 02:37 PM   #84
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
Thumbs down

My serious beef with Java is, "which Java?" The various implementations are not exactly the same. This is particularly true in the one place where you are most likely to use it: on the client-side, in a web browser. I have literally seen web sites that polled your browser-id and downloaded different source-code to do the same thing, according to what browser you ran. And I simply don't have the time or the money to do that. When I do a job, I like profits...
 
Old 06-02-2006, 03:18 PM   #85
NetRAVEN5000
Member
 
Registered: May 2005
Distribution: Ubuntu 9.04
Posts: 320

Rep: Reputation: 30
Quote:
Originally Posted by sundialsvcs
My serious beef with Java is, "which Java?" The various implementations are not exactly the same. This is particularly true in the one place where you are most likely to use it: on the client-side, in a web browser. I have literally seen web sites that polled your browser-id and downloaded different source-code to do the same thing, according to what browser you ran. And I simply don't have the time or the money to do that. When I do a job, I like profits...
The main reason for this is that different browsers have different features. Some of them specifically block certain pieces of code because they are sometimes used in spyware/adware.
 
Old 06-02-2006, 03:23 PM   #86
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by sundialsvcs
I have literally seen web sites that polled your browser-id and downloaded different source-code to do the same thing, according to what browser you ran.
Surely you mean which JVM?

Just so I understand is the byte-code just compiled under a different version of the compiler, or is it different source code? If the source code is different then what sort of changes are required?
 
Old 06-02-2006, 04:10 PM   #87
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
Quote:
There ware some suggestions that C supports object orientation. That is plainly wrong and the code example that tuxdev gave was not inheritance (let alone multiple inheritance) but association.
A nice article explaining that C can use an OOP paradigm quite nicely.
http://www.accu.org/acornsig/public/articles/oop_c.html

Multiple inheritance was added in CFront 2.0 or so, and was CFront still a C preprocessor. I am pretty sure that it was implemented the way I indicated. Doesn't really matter if it is called 'association' or 'multiple inheritance'.

Quote:
The debate about a trace was good but it missed the scenario of where there is no user to report the steps that caused the system to fail. A trace is an invaluable tool when debugging batch processes. Additionally, the overhead to generating a trace is minimal because all the information is on the program stack anyway, it just requires to be interpreted at the moment of the error, which is (presumably) done by the JVM, thus not adding anything to the bytecode as suggested by tuxdev.
I don't think I've explained whats going on in my head properly. I am not saying that traces aren't a invaluable debugging tool, just that reporting them are simply not as useful as steps to reproduce because
a. If I reproduce it, I just generated a stack trace
b. I can't tell for sure whether or not I've fixed something without unsuccesfully reproducing a bug.

Debug info is still in the bytecode. Otherwise, the stack trace could not be generated. How else would the Java JVM know what the name of the class and the method that it crashed in? Another side effect of things is that you cannot debug a Java app as well as a C app without using Eclipse or other special debugging JVM.
 
Old 06-02-2006, 05:22 PM   #88
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by tuxdev
A nice article explaining that C can use an OOP paradigm quite nicely.
An interesting article that borrows the class concept, but basically it is an argument for organising your code and that the OO approach can help produce more structured code. Whilst there is no one definition of what a language requires to be called OO the following are common criteria:
  1. Classes
  2. Encapsulation
  3. Inheritance
  4. Polymorphism
The C language doesn't support any of these natively.

"The first C++ compiler (Cfront) was written in C++." from Bjarne Stroustrup's FAQ

Quote:
Originally Posted by tuxdev
Doesn't really matter if it is called 'association' or 'multiple inheritance'.
It does, since they are completely different things. Association is about asking the question, does this object "have a" as in Object A has an instance of objectB. Whilst inheritance is about asking the question "is a" as in objectA is a more refined version of objectB.

To give an example consider the class used to model a car. The car class will have an engine object and it will have a set of wheel objects. Next the class sports car is a car with aerodynamic objects added. So the sports car will inherit car and with it the association to engine and wheel objects (not necessarily the same objects, the engine will probably be more powerful) and it will then add to that a collection of aerodynamic objects.

Traces
I agree with your point that, to know if you have fixed the problem you first want to be able to replicate it but that is not always possible. When I worked on mainframes and was maintaining part of the overnight stream if something went wrong it needed to be fixed and so a trace was my best tool. I could run the same data over my part of the stream but I'd only know if my patch really worked when it ran that night, because with an eight hour stream I don't know what the knock on effects of my change will be?

Last edited by graemef; 06-02-2006 at 05:24 PM.
 
Old 06-02-2006, 05:33 PM   #89
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by tuxdev
Debug info is still in the bytecode. Otherwise, the stack trace could not be generated. How else would the Java JVM know what the name of the class and the method that it crashed in?
Yes, sorry I was probably wrong with that. It will probably have a lookup table to convert mangled names so that they can be pretty printed in the trace.
 
Old 06-03-2006, 08:57 AM   #90
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by graemef
Whilst there is no one definition of what a language requires to be called OO the following are common criteria:
  1. Classes
  2. Encapsulation
  3. Inheritance
  4. Polymorphism
The C language doesn't support any of these natively.
That depends on what you mean by `natively'. It's true that there is no syntactical support for those notions, and I believe the C standard doesn't mention the notion of classes/inheritance/....

However, the point being made that "C can do OOP" isn't about that. It's about whether you can--how shall I put this... "perform the same tricks", irrespective of whether or not there is special syntax for it.

And you can do just that. The distiction between inheritance and aggregation exists in the mind of the programmer. If the language helps the programmer remember and/or test which is which, that's great, but it doesn't change whether or not the same effects can be achieved.
Code:
struct foo { int m_fred; };
struct bar { int m_fish; };
struct baz { struct foo s_foo; struct bar a_bar; int im_qux; };
(here `s' means super, `a' means aggregation and `im' mean private member).

Polymorphism can be obtained with function pointers, and I'm not completely sure what encapsulation means to you.

I take it you disagree with the person who referenced an article saying that java can do multiple inheritance.

Since python is OO and is implemented in C, quite clearly C can do OOP. However, this particular arguments feels a bit like cheating. If I wrote a python interpreter in assembly (or had gcc generate one for me), I could also claim that assembly supports OOP. In fact, any language which can implement g++, python or a jvm supports OOP, but that's really cheating.
 
  


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 09:04 PM.

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