GeneralThis forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
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 01:58 PM.
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.
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
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.
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
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
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.
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...
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.
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?
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.
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.
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:
Classes
Encapsulation
Inheritance
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?
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.
Whilst there is no one definition of what a language requires to be called OO the following are common criteria:
Classes
Encapsulation
Inheritance
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.