Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 16th, 2005, 4:14 PM   #51
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
look a few threads up...
Quote:
Originally Posted by OpenLoop
I say False advertisement because multiple inheritance is possible in java by using interfaces and java runs on JVM which can be downloaded for windows, MacOS, and most Linux distros AND which also guaranties that your program will run identically across systems.

EDIT: And who said you can only have one class per file, you got it all wrong buddy. You're only allowed one PUBLIC class per file but you can have as many private classes as you want to be used within that file.
Quote:
Originally Posted by Cerulean
Precisely. The focus was on the inflexibility, and my argument stands in that regard.
My focus was on false advertisement. Besides, If you're going to design a well organized language and platform like java and jvm, you must have some restrictions to keep things in order.

Quote:
Originally Posted by Cerulean
*politely requests the reasoning behind this opinion*
I had a brief experience with python and here's some things that i like in programming languages and that Python didn't have:
- I like C style syntax because it's easier to read
- well defined variables because it's easier to maintain
- pure OO because it makes sence(to me)

Bottom line, I don't like loose languages that has too few rules.

Quote:
Originally Posted by Cerulean
You didn't answer my question as to how Java is a more powerful language
For the same reasons C++ is, : strong typed, portable, Object Oriented, well designed, well structured libraries. Additionally, Java can be used to program microcontroller, Cell phones, and PDAs. For me, that's enough for a language to be powerful.
OpenLoop is offline   Reply With Quote
Old Aug 16th, 2005, 4:44 PM   #52
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Quote:
- I like C style syntax because it's easier to read
Well, don't ignore the fact that Python was designed with readability as a focal point, and i'm quite surprised you haven't given credit to that. I find it the most readable language out there, and you'll find a fair few people that agree with me.
C-style languages aren't readable when you have to adjust yourself to the 103149127 styles of indenting adopted by people.

Quote:
For the same reasons C++ is, : strong typed, portable, Object Oriented, well designed, well structured libraries.
You just pointed out some of Python's stronger points. As I mentioned, it's more portable than Java. It's more object orientated than C++ (all built in types are objects and can be subclassed). It really is viewed as a well designed language by many, but that's your individual (albeit unique) take on it and you're entitled to it. Wonderfully documented libraries (with documentation "built in" to the objects that you can access at run-time) are a great boast of Python's.
As for Python being weakly typed and C++ being strongly typed..... highly debatable, depending on your definition of strongly/weakly typed. May I recommend you read this.
Cerulean is offline   Reply With Quote
Old Aug 17th, 2005, 1:33 AM   #53
hydroxide
Programmer
 
Join Date: Apr 2005
Posts: 73
Rep Power: 4 hydroxide is on a distinguished road
Java CodeFu Challenge 1

OpenLoop, how about a challenge - demonstrate your Java code-fu versus my Python code-fu.

Here's a spec I just whipped up - it doesn't do anything particularly tricky or language specific - read data from a file, process the data, write data to a file. The actual design of the program internals can be whatever you feel best exhibits java style - the primary concern is that it reads the input processes it, and outputs correctly (that said, the prettier your code, the better). If, for instance, different parts of the output would be best done at different times then do it. If you accept, the next challenge will use OO ;-)

Start with mydata.txt containing the following text
3213214214214214:0214214214214214  :@!42121242142: 23213214214
6262626426262  : 0xabc14214214de : 12132131242142144
2132132132976  :foo:            121
056612321:  0x670E43242DDDDDDDDDDDDDDDDDDDDDDDDDDDD4C

Input
  • mydata.txt contains a quantity of positive integers
  • The numbers are always delimited by colons or newlines
  • Numbers beginning with 0 are in base 8.
  • Numbers beginning with 0x are in base 16.
  • Other numbers are integers.
  • Anything else is treated as a comment, and ignored
  • numbers are of arbitrary size.
  • The program is to read in mydata.txt.

Processing:
  • read in all numbers.
  • if the last number read is odd then sort the numbers by value in reverse; otherwise sort the numbers by value normally (ie: 010 < 9 <0xA)
  • sum the numbers
  • average the numbers (rounding to integer)
  • aggregate the last and first digits of each of the sorted numbers (base 10) into a new number (ie: if your sorted numbers were [101, 0xCC, 0465], the aggregate would be 114293)

Output (to mydata.txt):
  • write the sorted numbers to mydata.txt, interspersing them with a random choice of ":" or "\n" and any amount of space. Numbers should be written in whichever format they were read.
  • Then write "Sum : <whatever the sum is in base 8>"
  • Then write "Average : <whatever the average is in base 16>"
  • Then write "Aggregate : <whatever the aggregate is>" (this may be either in base 10 or in base 8, depending on the leading digit)

The code should produce the same sum, average, and aggregate when run N times.

--OH.
hydroxide is offline   Reply With Quote
Old Aug 17th, 2005, 2:02 AM   #54
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,869
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Yes, we should all just lead in to a giant flame war about why other people should convert to the languages we prefer.
Sane is online now   Reply With Quote
Old Aug 17th, 2005, 3:01 AM   #55
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
Quote:
Yes, we should all just lead in to a giant flame war about why other people should convert to the languages we prefer.
Or we should all just lead in to a giant flame war about why other people should convert to Python.
coldDeath is offline   Reply With Quote
Old Aug 17th, 2005, 4:24 AM   #56
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
little boys will always compare the 'thingies'

'tis a fact of nature.
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Aug 17th, 2005, 5:09 AM   #57
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
I don't see how this is a flame war. It's just a remotely heated discussion. It hasn't turned into "you smell" "no, you smell!" "NO! YOU smell" or anything.
Cerulean is offline   Reply With Quote
Old Aug 17th, 2005, 9:30 AM   #58
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
This thread is for verb and he was asking a simple question. Let's not hijack it into a flame war.

hydroxide, I got a better idea for you. See my other thread about prime numbers calculation to see which language is faster. Sure python code is compact, the same program could have 40% less code but like i said, it all comes at a cost. Candy is sweet, only if you don't care about your teeth
OpenLoop is offline   Reply With Quote
Old Aug 21st, 2005, 5:51 AM   #59
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by OpenLoop
I say False advertisement because multiple inheritance is possible in java by using interfaces and java runs on JVM which can be downloaded for windows, MacOS, and most Linux distros AND which also guaranties that your program will run identically across systems.
I have to respectfully disagree here. Interfaces are not the same as multiple inheritance. With interfaces, you often end up with duplicate code that could have been avoided with multiple inheritance. A good example of this is HTTPUnit. Whilst I was looking through this to fix a bug in the getDOM method, I came across several duplicated functions that could have been avoided with a multple inheritance model like Python's.

Interfaces give the appearence of multiple inheritance without giving the user the advantage of code reuse that true multiple inheritance brings. This is similar to Java 1.5.0 autoboxing, which gives the appearence of a complete object model without this actually being the case.

With regards to Java being more powerful than Python, this depends on what you mean. Java is faster than Python, and arguably has more libraries, but Python is the more advanced language of the two. I'd put forward the suggestion that Python a more powerful language than Java, because it frequently allows one to implement programs in less code than Java.

But it depends on your definition. I'd also define Java as being more powerful than C, something which you may disagree about.
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:32 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC