Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Java question


Mouzi's Avatar
Member
0 0

I don't know much about java and I haven't coded much in java, but I'd like to know what purpose addresses like "org.apache.tools…" have in java? How are they used? where are they used? and why are they in that form? Is it same as "apache.org/tools"? (just an example) I thought they could be addresses to other java files and to parts like classes of them, but idk. confused


ghost's Avatar
0 0

Mouzi wrote: I don't know much about java and I haven't coded much in java, but I'd like to know what purpose addresses like "org.apache.tools…" have in java? How are they used? where are they used? and why are they in that form? Is it same as "apache.org/tools"? (just an example) I thought they could be addresses to other java files and to parts like classes of them, but idk. confused

They are packages and are basically used to separate your class files into logical groups and makes for easier code maintenance as the classes must be put in directories that match their package. So if my class is in the package foo.bar then my class would be in the directory CLASS_PATH/foo/bar/.

The import statement is used to import (funnily enough) a class from a package so your class can access it, e.g.

markupimport java.util.ArrayList;

will import the class ArrayList from the package java.util so you can use it.

I hope that makes sense, I'm tired and feeling quite out of it.

EDIT: If this makes no sense, or you need mroe clarifying, pm me


regret's Avatar
Attack-Vector Perl
0 0

All true modern programming language as an inclusion system like this…

C++ (example #include <stdin.h>) PERL (example use File::Copy;) etc, etc, etc


ghost's Avatar
0 0

regret wrote: All true modern programming language as an inclusion system like this…

C++ (example #include <stdin.h>) PERL (example use File::Copy;) etc, etc, etc javascript isn't a programming language because it doesn't include another file or directly declare a use of a library ?


regret's Avatar
Attack-Vector Perl
0 0

Javascript, by it's own name is a "Scripting Language". Yes, you can develop web applications and whatknot with the languages, but it still requires another language (HTML or one of it's variants) to call upon the script to run…so in my opinion (and that's exactly what it is, "my opinion") Javascript is not a programming language.


ghost's Avatar
0 0

regret wrote: Javascript, by it's own name is a "Scripting Language". Yes, you can develop web applications and whatknot with the languages, but it still requires another language (HTML or one of it's variants) to call upon the script to run…so in my opinion (and that's exactly what it is, "my opinion") Javascript is not a programming language. the majority of javascript guides/books are bad


ghost's Avatar
0 0

Well…

w3schools

Browser Scripting Learn JavaScript JavaScript is the scripting language of the Web!

http://www.google.co.uk/search?q=define%3Ajavascript

JavaScript is a script language - a system of programming codes Scripting language (originally called LiveScript) developed by Netscape Communications for use with the Navigator browser

As I'm sure you can see why this person believes Javascript is a scripting language ;)


ghost's Avatar
0 0

You should watch some of Doug Crockford's videos he actually explains it quite well.

EDIT: To HBH developers, make a [quote] bbCode that actually works with the 'quote' button.


ghost's Avatar
0 0

JavaScript is a scripting language. Just like PHP is, or at least used to be, with things like bcompiler and php-gtk is could perhaps be called a programming language.

The reason W3C doesn't mention JS is because they aren't the people who manage it. Mozilla are the people building JS2, or at least the main contributers, let's see what they say it is. From: http://developer.mozilla.org/en/docs/About_JavaScript

JavaScript is a dynamic scripting language Since you really wanted a quote from W3C: From: http://www.w3.org/TR/html401/interact/scripts.html#h-18.2 (referring to the <script> tag) The following sections discuss issues that concern user agents that support scripting. and: Scripts are evaluated by script engines that must be known to a user agent.

maybe you should do some research into the subject and read info from people who actually know what they're talking about I know what I'm talking about.


ghost's Avatar
0 0

I'm not sure if I should trust your knowledge over Douglas Crockfords.

And the mozilla link you gave me actually presents:

About Javascript From MDC There is currently no text in this page, you can search for this page title in other pages or edit this page.


spyware's Avatar
Banned
0 0

Is the difference between "scripting" and "programming" that big?

define:scripting language

A programming language which is designed for a particular application domain. The language includes nouns for referring to objects in the domain, such as "button", "cell", and "author". Generally, a scripting language has simpler syntax and fewer programming constructs than a programming language like C.

define:programming language

A computer, human-created language used to write instructions for a computer.

So scripting is lightweight programming (in a nutshell)?


Uber0n's Avatar
Member
0 0

spyware wrote: So scripting is lightweight programming (in a nutshell)?

A script language is not compiled, that's the difference ^^


ghost's Avatar
0 0

Mals, sorry the page indeed doesn't exist, I'd been looking at a google cache. I'd like to point out that the link you pointed to (http://developer.mozilla.org/en/docs/New_in_Javascript_1.7) doesn't exist either.

I've never before heard of Douglas Crockford, but I see he is a developer of JS over at Yahoo. Here's a quote from his site:

The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language. But it is really a matter of specialization. Compared to C, JavaScript trades performance for expressive power and dynamism. He obviously calls it a programming language. Something I disagree with. While the definition for a scripting language is probably not strict I have always felt that scripting languages are usually interpreted languages (as opposed to compiled languages). Furthermore scripting languages are embedded in whatever it is they affect. This would mean that JS, bash and MatLab are all scripting languages. In contrast programming languages are languages that get compiled into a system dependent binary form (Java being compiled into bytecode is (by my definition) a programming language too).

As to what Douglas means by "But it is really a matter of specialization", I don't quite know for certain but it's my hunch he means something along the lines of "it's a matter of preference".

By my definition JavaScript is pretty much the epitome of a scripting language. If it isn't one then what the hell is?


ghost's Avatar
0 0

I believe PHP is both a scripting and a programming language depending on how you use it.

It seems also to be the case for Javascript, although one dude from Yahoo! hasn't convinced me.


ghost's Avatar
0 0

Mals wrote: WhiteAcid: The link http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7 is fine for me.

I understand your point, however why is it that javascript isn't a programming language? Until recently I also thought the way you did (interpreted lang->script, compiled lang->program). Then i asked myself, why must programming require compilation ? And now more recently where we're seeing that PHP scripts can be compiled into stand alone .exe's and create GUI apps. And with your comment about Java, Java, runs inside another program, the Java Virtual Machine, like PHP does, which we know as a scripting language, this makes the subject very confusing. Even modern .net languages are compiled to an intermediate language first.

It's getting more difficult to distinguish a difference, and after some thought it's difficult to define what makes a scripting lang. a scripting lang. and what makes a programming lang. a programming lang.

I guess the difference is; scripting languages are more dynamic and open.

For those who aren't sure what I'm talking about, or who Doug Crockford is: "The Javascript Programming language - The world's more mis-understood programming language" http://video.yahoo.com/video/play?ei=UTF-8&b=26&vid=111593&gid=133414

EDIT: A note about the links, you're right the link didn't work if I went to it directly, it only seems to work if you click from the previous page: http://developer.mozilla.org/en/docs/JavaScript

.|Mals

sir, you are wrong. and, it troubles me that you base this whole argument of yours on something one man has said, rather then on things that are STANDARDLY ACCEPTED to be correct, just to provoke argument. this thread was never about javascript, and it shouldn't be.

there is a time to be a libertine, and a time to know what you're talking about.

and does it really matter? who cares what someone calls the stupid language. jeez.


ghost's Avatar
0 0

oh, what did i say that was wrong?


Mouzi's Avatar
Member
0 0

Wow, this went totally off-topic. o.o

But hey. I have one question related to the original topic: Can I access those files through my web browser? So if the address would be my example org.apache.tools … could I go to apache.org/tools/ … and get to the file? I've tried it though and got 404. (not in that address).

EDIT: Btw my opinion: JavaScript is scripting language because it's not compiled. It's a fact so I don't really even get this argument o.O

Of course you can always argue if languages that are not compiled are still programming languages. But that would mean other languages too, not only JavaScript.


richohealey's Avatar
Python Ninja
0 0

in modern terms a language is defined as a scripting language if it's interpreted. Also scripted is a subclass of the more global term "programming language", Python, PHP, PERL, and so on and so forth are all programming languages, they are also scripted because they aren't natively compiled.


ghost's Avatar
0 0

Mouzi wrote: But hey. I have one question related to the original topic: Can I access those files through my web browser? So if the address would be my example org.apache.tools … could I go to apache.org/tools/ … and get to the file? I've tried it though and got 404. (not in that address).

No. That path is only used by the Java compiler/VM to find the classes it needs, and will only work locally as the org/apache/tools section of the path is appended to the path in the CLASS_PATH environment variable. It isnt a URL, the period is just used to separate package names.

If you want to see the docs for the classes in the org.apache.tools package try and find the JavaDoc documentation for it (Google is your friend).

Hope that helped