Author | Topic |

I supported Toymods On probation
Location: Brisbane, Queensland
Registered: January 2003
|
Java Problem
|
Fri, 08 August 2003 06:48
|
 |
i am just starting to learn java at tafe and need to finish sign off activities by the end of this lesson which finishes at 6.
i've done the first 4 and i'm stuck on the fith... i'm not cheating just need this as a back up if it comes to 5.55 and i havn't finished.
The question is... write a program that will read integers and find the total and average of the input values, not counting zeros. the program ends with the input 0. display the average as a floating point number.
Cheers
|
|
|

I supported Toymods On probation
Location: Brisbane, Queensland
Registered: January 2003
|
Re: Java Problem
|
Fri, 08 August 2003 07:29

|
 |
Never mind i finished it myself.... it's fairly dodgy though.
/* Created by Jake Shaw
* totav.java
* totals and averages
*/
public class totav
{
public static void main (String[] args)
{
float data = 0;
float sum = 0;
float count = -1;
float ave = 0;
do
{
System.out.println ("Enter a number");
data = MyInput.readInt();
count++;
sum += data;
}
while (data != 0);
ave = (sum / count);
System.out.println ("The sum is " +sum);
System.out.println ("The average is " +ave);
}
}
|
|
|
Club Member
Location: Sydney, NSW
Registered: May 2002
|
Re: Java Problem
|
Fri, 08 August 2003 09:35

|
 |
Whoa ...
Now I know why I never studied computer courses at school... I only did Information Technology which was basic...
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Fri, 08 August 2003 10:20

|
 |
Java is too much like 'real' programming to me. i'll just stick to my php/mysql/javascript/css/html
|
|
|

Location: Sydney
Registered: July 2002
|
|
|

Location: ballarat
Registered: April 2003
|
Re: Java Problem
|
Mon, 11 August 2003 02:58

|
 |
i love java, but being interpreted, its so f**king slow
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Mon, 11 August 2003 03:38

|
 |
HKSPete wrote on Mon, 11 August 2003 10:53 |
gtman wrote on Fri, 08 August 2003 20:20 | Java is too much like 'real' programming to me. i'll just stick to my php/mysql/javascript/css/html 
|
Java is where the money is
No one pays for php/mysql/javascript/css/html anymore because everyone can do it.
Edit: spelling
|
I beg to differ personally. A good php programmer can make a good living these days. It might be simple to get into but its pretty deep, and you can do almost anything you would need to do in it. Doing websites in Java makes absolutely no sense at all, and only masochists do it in asp or asp.net
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Mon, 11 August 2003 08:08

|
 |
Was seeing if anyone would bite on that one.
In my opinion:
Java is built for Web Systems. Not web sites. Web sites can be done by "Web Designers" - high school kids.
I don't know of any LARGE company that uses the net for LARGE applications that use PHP. Please feel free to correct me, but please make sure you state what database they're using, what web servers they're running, and what the application of it is.
I've never heard of anyone using PHP to a big oracle database. But my knowledge isn't towards the PHP area of the net.
In my opinion:
PHP is good for forums, good for online sales stuff (ebay, etc.) but not good for stuff like online banking or other heavy duty applications.
Sites that I'd class as big that use java: "jobnet" upgraded from php about 3 years ago, the entire airline industry (galileo southern cross, qantas, virgin), centerlink, MLC, etc.
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Mon, 11 August 2003 14:21

|
 |
I'd like to make a quick distintion here, between web designer, and web developer.
Web Designer : yes, this can be someone out of high school, they use PhotoShop, Dreamweaver and Flash to make designs of sites. They know HTML/CSS and rudamentry JavaScript
Web Developer : This person makes the site work, they develop the backend databases, front end wizadry etc etc. This person will generally know HTML/CSS more advanced JS, then their chosen scripting/programming language and database.
ok, now I got that out of the way 
PHP is now the biggest and most widely used scripting language on the net. Earlier this year it 'officially' took over from ASP, I say 'officially' as there is no exact science, but from all reports it did, and now most certainly has. True, it wasn't designed to do hard core transactional things, in this sense, something like Java is most certainly better, as its a programming language, not a scripting language. One big website that uses PHP is SourceForge, tho being an open source website what can you expect I think big companies problems with PHP is basically it doesn't cost anything and is open source. Close the source, charge some insane price for using it, and they will immediately think, ah, costly must mean good quality! whereas they associate free with crap. The language is just and strong and in all reality, stronger and more flexible then cfm and asp. One of the guys I used to work with HATED doing asp, as things that took 5-6-10 lines in asp you can do in a single line or sometimes a single command in php, its just so much better. Whereas ASP is a web implimentation of VB, PHP was built for the web, so it makes so much more sense to use it.
Anywho, enough of my fanatical rambling Here's a nice artical, tho slightly incorrect in some of its facts http://www.newsfactor.com/perl/story/21795.html
In terms of databases, php natively supports oracle but most people use mysql being as it is free, and is once again designed for the web so for a web implimentation its much better then oracle or MsQL, which php also natively supports. Plus you can use a database abstraction layer so it doesn't matter what db you or you clients are using. Thats probably the other best thing about php, its so portable. I develop on windows but deploy on unix. I could use a database abstraction layer and develop on mysql and deploy on oracle, its just so damn flexible
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Mon, 11 August 2003 23:27

|
 |
Your dead right, PHP is a script language.
A few things though: Java is free. Tomcat apache web server is free. There are free databases that anyone can connect to.
The reason why big companies pay for web servers and databases is the support contract that comes with it. We're currently porting a large directory server to oracle, and because its oracle we can get an oracle senior architecht in to design it and help with the transition.
We're often talking to BEA about a glitch in the weblogic server, sometimes glitches that no-one else has found yet (i doubt it though), and because we pay through the nose for it, BEA actually listens, and finds a work around until they can write it into their next release.
Free doesn't mean crap, just crap service. And don't go into you can find whatever you want on the net because if your getting right into the nitty gritty stuff and find a problem, theres no guarantee that someone else has found it and actually written about it.
Oh and talk about being portable - HA. Java is the pioneer of portability. When you can go from windows to unix to WAP phones or PDAs etc. PHP doesn't rate in the flexibility stake, its a web based tool.
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Tue, 12 August 2003 01:30

|
 |
I'm comparing PHP's portability to say, ASP's or CFM's, which is basically non-existant Comparing PHP to Java is apple's to oranges, as we've already established, one is script, one is programming.
I believe you can pay for support with any of these free alternatives as well, I mean, thats how they make their money, not through sales, but through support. Redhat, MySQL and Zend all offer support contracts, so I can't really see this as a problem either. In this sense, you have two lots of support really, the support you are paying for and the tons of information that the geek in his basement is writing about
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 01:55

|
 |
Yes, you were comparing PHP to ASP etc.
I was saying Java pays more.
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Tue, 12 August 2003 02:20

|
 |
cause there's less people programming in it as you have to be mentally unstable to want to (cheap shot)
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 02:37

|
 |
Exchanging sanity for currency.
|
|
|

Location: ballarat
Registered: April 2003
|
Re: Java Problem
|
Tue, 12 August 2003 03:00

|
 |
java applets have almost disappeared on the web, being replaced by flash, all that remains are jsp. java seems to be more aimed at application programming now, (what i use at work), but i also hear it is making leaps and bounds in the embedded market (j2me)
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 03:15

|
 |
Java has HAD the embedded market for years. Most mobile phones use J2ME. I actually wrote a phone game a couple of years ago in J2ME, it didn't sell though.
Flash is like PHP and ASP etc. It can be done by the masses.
|
|
|

Location: ballarat
Registered: April 2003
|
Re: Java Problem
|
Tue, 12 August 2003 03:26

|
 |
i like java alot, everything is elegent, especially the event handling and the object factories. but have you ever tried to find memory leaks? wholly shit this is hard. the garbage collector is supposed to get rid of all of this for you, but if you any kind of persitant objects in memory having unsed object handles, the garbage collector just leaves it. i think this job is easier in c++.
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 03:38

|
 |
What sort of persistant objects are you using?
Showing that there are memory leaks is easy, tracking them down is hard. Especialy when its someone elses code and they've used old/outdated design principals.
|
|
|

Location: ballarat
Registered: April 2003
|
Re: Java Problem
|
Tue, 12 August 2003 03:43

|
 |
like singletons (not my choice of design, but my project manager is ex-delphi where apparently this was 'good design')
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 03:49

|
 |
singleton is a good patern, but it can be very quickly missused.
If you make a list of all your stateless singleton classes and go through them one by one and make sure they neeeed to be a singleton.
|
|
|

Location: ballarat
Registered: April 2003
|
Re: Java Problem
|
Tue, 12 August 2003 03:58

|
 |
yeah thats pretty much what we've been doing, also making sure that every complex instance/class varible is set to null when finalize() is called. its better, but still has leaks
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Tue, 12 August 2003 04:35

|
 |
and that little conversation is why I stick to scripting
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 06:34

|
 |
Yeah, leave java to the smart people (cheap shot)
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Tue, 12 August 2003 06:58

|
 |
ouch, that was cheap
|
|
|

I supported Toymods
Location: Northern Beaches
Registered: May 2002
|
Re: Java Problem
|
Tue, 12 August 2003 12:46

|
 |
java is great, but if you want any speed in things that are computationaly intensive you gotta use something like c++, too much overhead in java.
Good old singletons, we just went through all the OO design patterns last semester YAY
Some of those patterns are pretty damn cool.
Where do you guys work?
Whats the best way for a graduate to seek a job, this is my last year and I need to find somewhere.
Need an enthusiastic graduate from Sydney Uni? hehe
|
|
|

Location: ballarat
Registered: April 2003
|
Re: Java Problem
|
Tue, 12 August 2003 23:48

|
 |
i work for my local university, mainly r&d in heathcare messaging
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Tue, 12 August 2003 23:58

|
 |
What sort of job do you want?
"Its not what you know, its who you know"
My last 3 jobs have all been through someone I know. Give your resume to your closest friends in the field and see if they can hand it around, or at least listen out for a job.
Another way is working out where you want to work and walk in and ask for a job. The secretary will probably palm you off to the HR department and you can tell them you want a job.
I went to over 40 interviews with stupid headhunters (agencies that find people to fit into jobs), I got so frustrated as some would make me have an interview with them when they didn't even have a job for me to go for "just in case one comes up we need to know you can do it". I got thrown out of one of them as I wouldn't fill out their forms until they told me what jobs they had on offer. I yelled at the guy when he said he didn't have any. That was the last one I went to. From then on, it was actual job interviews only.
|
|
|

Location: Cabramatta, NSW
Registered: May 2002
|
Re: Java Problem
|
Wed, 13 August 2003 01:50

|
 |
The way I see it is that PHP is perfect for hacking something quick and dirty together.
Small systems are suitable, but if you've got more than 3 developers working on the system, then I don't think PHP is suitable.
PHP4 has the OO sorta stuff, but at the end of the day it's still a procedural language with all the associated drawbacks like badly defined scope and the need to compile each time (although optimisers like Zend will compile and cache PHP code for you).
From what I've heard about PHP5 is that the OO stuff has been cleaned up a lot and things such as scope are similar to Java. Even has interfaces and all that jazz so you can do things like implement you beloved singleton pattern. 
But for real developer work, especially in a large team, Java rocks. It's a lot easier to do things in Java, especially with IDEs and UML tools these days that virtually write the code for you.
A good Java IDE will handle all the necessary imports, do code completion (ie: start typing in the name of a variable or a class's method and it'll suggest the closest match to you), it'll also do on the fly syntax and method invocation checking for you. They'll generate the JavaDoc for you so that other developers can start using your classes straight away (even if your code hasn't been written yet).
Show me a PHP IDE that'll do that.
Granted, Java is overkill for some things, but 6 months down the track, when you have to extend the code base, it is sooOOOoo much better than PHP (and any other scripting language).
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Wed, 13 August 2003 01:59

|
 |
Nark wrote on Wed, 13 August 2003 09:50 | Show me a PHP IDE that'll do that.
|
Zend Studio 
I hear what you're saying Nark, but imo, using java for displaying webpages makes no sense. For backend systems, yes, but for the actual webpages, thas the domain of the scripting languages, thats what they where created for and thats where they are best. Using Java to display web pages is overkill.
edit: and as long as you do structure your code well from the start, adding stuff in later is no problem, but then again the same could be said about any language.
[Updated on: Wed, 13 August 2003 02:00]
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Wed, 13 August 2003 02:05

|
 |
Web Designers use scripting languages
Web Developers use Java
|
|
|

Location: Cabramatta, NSW
Registered: May 2002
|
Re: Java Problem
|
Wed, 13 August 2003 02:33

|
 |
I must admit, my experience with PHP IDEs is very limited. Most of my PHP work is just done on an HTML editor like Bluefish. 
The beauty of Java is that, yes, it's a bit overkill for the front end, but you've got a solid back end. Plus, in large teams, you can have clearly defined areas of ownership for each developer.
If you do things properly, you could even have a web designer do all the front end stuff (as long as you're using taglibs) without even needing to know Java. All the while, you can have developers writing the classes. Very handy if you're using an MVC architecture.
You can do MVC in PHP, but that's a bit overkill. By the time you're thinking of MVC in PHP, you're better off doing it all in Java...
There are situations where one is a better choice than the other, but if it was a toss up, then I'd go the Java route every time.
I should also mention that I hate scripting languages...
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Wed, 13 August 2003 02:41

|
 |
HKSPete wrote on Wed, 13 August 2003 10:05 | Web Designers use scripting languages
Web Developers use Java
|
I would just like to point out that I resent that 
would you class a CMS as a web development program? You show me one cms written in Java and I'll show you 20 written in a scripting language like php/asp/cfm. Funny that GlobalScape, a huge company, decided to write their pretty swanky cms in php. My company is writing one in php as well, and it is looking very purdy. The Zend IDE has built in CVS so multi-user isn't a problem. It does all the code hinting/completion so thats all good. You can get PHPDoc that is exactly the same as JavaDoc. Like I said before, Java is the obvious choice for transactional systems and other heavy backend things. Everything else imo can be scripted, and php imho is the best.
|
|
|

Location: Cabramatta, NSW
Registered: May 2002
|
Re: Java Problem
|
Wed, 13 August 2003 03:09

|
 |
I've built many CMSs in both PHP and Java, and I'd go with Java any time.
Java just has better support and better tools. Can you use a UML tool to do your system architecture and then have it spit out skeleton code (including fully documented classes)?
Can you reverse engineer your database and have accessor classes built automatically for you?
Do you need to worry about problems with scope?
Can you easily package your entire application into a single file and just copy it across into another appserver?
Do you have standardised logging (log4j) and unit testing (JUnit)?
Do you have the ability to throw and catch exceptions for better error handling? Well, not until PHP5. And HKSPete, stay out of this! 
As a development environment, Java is just so much better.
|
|
|

Location: Sydney
Registered: July 2002
|
Re: Java Problem
|
Wed, 13 August 2003 07:04

|
 |
Nark wrote on Wed, 13 August 2003 13:09 | And HKSPete, stay out of this! 
|
Awww. Don't make me go do "work"!
|
|
|

I supported Toymods
Location: Northern Beaches
Registered: May 2002
|
Re: Java Problem
|
Wed, 13 August 2003 14:35

|
 |
hehe very interesting arguments going on
Im looking at a software development job, not sure in what area and probably in either java or c++ as they are the main ones ive done.
Currently about to do a project of making a adhoc mobile network simulation in c++ and probably java front end, this is in a team of 5 which is all looking fun 
Not alot of jobs in the papers or internet for graduates without industry experience, there are a few graduate programs with bigger companies but they are highly competitive and not many positions.
How did you get your first jobs?
|
|
|

Location: Cabramatta, NSW
Registered: May 2002
|
Re: Java Problem
|
Wed, 13 August 2003 23:28

|
 |
I went through 5 years of Uni doing C++. Using vi....... *shudder*
Did Java in the last year and I've never looked back. C++ is a better language. You can do a lot more with it. I miss the pointers and multiple inheritence. *sniffle*
But everything is just so much easier with Java. No header files, no Makefiles, dynamic strings and a whole host of other useful stuff like linked lists, trees, and vectors all as a standard part of the language.
Write once and compile and it'll run on virtually any platform.
I came out of Uni during the Dot Com Boom, so I found a job pretty easy writing CMS's (content management systems) in TCL. *shudder*
In my interview, they asked me if I'd done TCL, I said "yes, and I absolutely hate it", so they hired me.... Bastards....
Been writing CMS's ever since, but at least I get to use a REAL programming language now...
It's a really hard time to graduate from an IT degree now. Most don't find jobs.
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Thu, 14 August 2003 03:25

|
 |
the cms's you write Nark, you do them on a site by site basis or are you making a generic program for everyone? Just out of curiosity as I stated I'm writing one as well, which will expand to be pretty huge arse, with native forums, calendars, galleries, shopping centre's, membership systems, mailing lists etc
|
|
|

Location: Cabramatta, NSW
Registered: May 2002
|
Re: Java Problem
|
Thu, 14 August 2003 03:49

|
 |
Well, I tend to move around a bit so normally they're on a site by site basis for whoever employs me, but I usually write them to be as generic as time and resources permit.
It also depends on if the employer is wanting the site for themselves or they're actually in the industry... 
The fun is in the designing and building of such systems, not the support and extension after the first release, so I normally bugger off after the system has been built. 
Right now, I'm involved in a "web unification" project for the CSIRO where the system that I'm making will combine and replace the 250+ websites that the CSIRO currently have...
So it's about as generic as you can get... But at the same time have the funky features like authoring tools, workflow, roles-based access rights, content sharing, inbuilt search engine, that sorta stuff. 
Your project sounds good. There are plenty out there that offer the same things though.. You got funky features that will distinguish yours from the rest?
|
|
|

Location: Perth
Registered: November 2002
|
Re: Java Problem
|
Thu, 14 August 2003 04:49
|
 |
well, this is the feature list for version 1.0 of just the site engine, not the other modules
Quote: |
version 1.0 will include the following features:
? member functionality
o multiple member types, paid and free
o member renewal functionality, with varying times and costs
o ability for members to organise into groups
o members be able to reply to articles, if allowed
o site admin to discriminate which members he wants to view articles
o ability for membership discounts - also for discounts to tie into shopping centre products
o hooks for other modules, such as shopping centre's, forums etc
? author management
o multiple authors with varying privileges
o author collaboration on articles
o full author messaging service, with cc, bcc etc
? page features
o pages to be put in multiple categories
o unpublished pages viewable by certain authors for revision/approval
o pages can include components, both first and third party
? site features
o polls :-
? authors can create polls that can be voted by certain groups, or only seen by certain groups
? polls can be displayed but not voted on
? timeouts on polls
o statistic tracking :-
? page access history
? user location diagrams
? in and exit points to see where users are being referred from and what links they are exiting from
? media files accessed
o media functionality :-
? images, movies and documents stored in the database instead of file system
? full privileges, with certain groups or individuals only allowed to see each media file
? timeout on access ability, either time or access based ie. three days or two views
? media files incorporate into stories holding access levels
? image size manipulation for jpeg and png images, on the fly
? media sets created that can be attached to stories
o site history :-
? admin can backup whole or portions of site to .sql files stored on the file system or downloaded
? .sql files can be loaded to replace current site, with current contents backed up automatically
? admin can create 'ghost' site, site generated from live php into static html and written to the file system, with images and files generated and written to the system
? affiliate features
o automatic, restricted or on request affiliate addition
o login section for affiliates to check stats
o hooks to communicate with central affiliate server once built
o ability for affiliate discounts on memberships and other products
? e-commerce features
o single product purchase ability
o users must be members to purchase products
o gateway abstraction for first and third parties to write wrappers for varying gateways
o discounts based on memberships, time, affiliates and any combination
o full reports for administrators
o users can continue orders if cancelled/errors
o shipping rates created and applied to multiple products
o automatic electronic delivery of media items
? administration features
o all functions except WYSIWYG to work in all current major browsers, IE, Opera, Netscape and Mozilla
o tabbed, multiple document interface (mdi) :-
? admin can click between different pages
? navigation links can be opened in same page or new page
o navigation based on privileges
o navigation to be expanded with the inclusion of new modules
o page locking functions for author collaboration
o temporary pages for unapproved/time delay modifications
o style sheet generator
|
we've basically looked around at all the best features of everyone else, plus the features in our own cms, and are building what I think is the most feature rich one I've seen. Plus with native linking inbetween modules, yeah I think we have enough funky features to distinguish
|
|
|