Regarding Java

Pages: 1234... 6
that java has become more aesthetically pleasing to me :O it was wrather depressing.


Can you give us some examples?
Dont really think I can. It's not a static "That way of doing things is SO much better looking than the other one" it's more of an over all it's cleaner looking code. I don't know. the one thing i was thinking of most when I realized this, though, was the access modifiers in
front of everything.
closed account (1yR4jE8b)
Well, Java doesn't have all the *, &, << and other misc. random symbols littered all over the place so it makes things easier on the eyes.
My c++ code has very little of this garbage (except maybe for the & sign, whose existence and shortness makes me happy).

I use the * sign veeery rarely (only if the 0 pointer is an allowed value).

If you write ugly code in C++, you will write ugly code in java too - this is a matter of style.

Last edited on

Regarding the way memory is managed, I ran into a large problem with garbage collection when I was writing real-time networking applications in Java. The problem didn't start until about 48 hours up-time under a moderate load, but having the main application thread pause for 3 seconds to collect garbage wasn't really acceptable in my case. The sessions that were forming were being moved to the old generation after being active for so long and weren't being collected until the full collection was invoked. I still haven't found a solution for how to tune the collector to avoid the pauses.


Try G1GC. It is new, but solves the tenured generation collection problem.
Actually for using Java and real time you have to buy a commercial JVM with full real time support (and region based memory management).



If you write ugly code in C++, you will write ugly code in java too - this is a matter of style.


However, it is easier to write elegant Java code than C++ code. And it is enormously easier to write elegant Scala code compared to Java code. This is what most hackers care about. They don't care how hard it is to write unreadable code, because they know what they do.
Last edited on
I've always said this about Java, she is the good looking women in the corner of the bar that everyone is attracted to. But you have to remember that she is dumber then a bag of hammers. I'll stick with my nerdy girl C++, sure she's a bit older and more difficult to deal with at times but the more I find out about her the more I fall in love.

QuitAnalogy(): If you want real world proof about what I said then think about this. It's no secret, even to Sun Microsystems, that Microsoft developed C# in order to compete with Java. There is a REASON that C# gained a foothold in the market so quick and contrary to what some conspiracy nuts might say it is NOT because of Bill throwing his weight around. Honestly if you like Java take a look in C#'s direction, you may find an even better match. If not then I'm sorry for wasting your time.
@Computergeek. I'm already skilled and experienced with C# but Java is what I'm required to know for school. I'm waiting for someone to wrap the Android API to C# so I can be more comfortable with developing for it.
You sir must have a horse-shoe where the sun don't shine. I had to look for two weeks and even then only complaining about it to a co-working got me this link: http://developer.android.com/sdk/ndk/index.html

EDIT: By the way, I found out about that less then an HOUR before you posted that. I know it isn't exactly C# but I was looking for C++.

RE-EDIT: This would seem to require a Java based launcher. Us non-Java authors would appriciate the help, *hint* *hint* *poke* *poke*
Last edited on
I already knew about the ndk, the problem with that is you have to recompile your code for every architecture that android supports. They openly state on the sight not to use it just because you prefer C++ over java, and only to use it where necessary.
When I posted that I had discovered it less then an hour ago I meant to imply that I had not had a chance to read it yet. That every architecture thing may be a bump in the road but I intend on seeing what this thing can to on my Transform.
Go for the gold my code-brother.

It's no secret, even to Sun Microsystems, that Microsoft developed C# in order to compete with Java


It's also no secret that it failed to overtake the Java market and it seems it is not going to happen (at least not in a decade). C# is used mostly for some non-critical, small scale business app frontends, but serious large scale backend and business logic stuff is written mostly in Java and C++. Examples of products where Java plays major role:

- Facebook (backend: HBase Java database, frontend PHP)
- Amazon (backend SimpleDB Java database)
- Most Google applications (GWT)
- LinkedIn (all Java and Scala)
- Twitter (backend: Scala, frontend: Ruby)
- Foursquare (all Scala)

Java shines also in things requiring high performance, scalability and reliability like database systems and web servers: Tomcat, Netty, Cassandra, HBase.

.NET is not there yet, and I presume it will never be, if 10 years of competition with Java was not enough.
Last edited on
closed account (S6k9GNh0)
Actually... during programming a small server for testing, I kinda found that I often don't like the syntax of C++. So, I found myself liking D more than C++ in that sense. However, I think Java syntax is absolutely ugly. I don't like the idea that everything is a class as well. Regardless of everything, I feel that I have more power and knowledge in C/++, so that's what I'm sticking with.
Last edited on
I don't like the idea that everything is a class
Everything's a class because it's an Object Oriented language. C++ is a Procedural Language too so stuff's either in a procedure (function) or object.

It shouldn't really bother you because the code's got to go somewhere, right?
I don't like the idea that everything is a class


How is that limiting? Methods are a perfect replacement for procedures - essentially, if you don't use the "this" pointer they are functions or procedures. The problem with Java is that *not* really everything is a class / object. E.g. arrays, primitive types and methods are not. Which makes it slightly less elegant and simple than it could be.
Last edited on
People defend their favourite languages so passionately...why not just use the best tool for the job in all situations rather than argue which language is 'best'
Methods are a perfect replacement for procedures
Only if you're implementing objects or abstract data types. It depends on the paradigm.
static methods in jva aren't too different from procedures residing in namespaces in C++ though.
Last edited on
closed account (z05DSL3A)
People defend their favourite languages so passionately...why not just use the best tool for the job in all situations rather than argue which language is 'best'


Loyalty to a language has it's roots in knowledge of a language, the 'Holy War' has its roots in ignorance of a language. It is easy to bend the language you know to produce the solution you seek. It is much harder to get the solution you desire from the language you misunderstand. Don't use the correct feature or use a coding technique incorrectly and your application performs like a lazy dog on Temazepam and 'that's got to be the fault of the language' as what programmer likes to admit they are wrong?

While I agree with the sentiment of 'use the best tool for the job', sometimes it becomes the worst tool in the hands of someone who can't use it correctly.

I would rather know a handful of languages competently than one perfectly. Having said that C++/CLI sucks. :0)




Only if you're implementing objects or abstract data types. It depends on the paradigm.


What are the semantic differences between this (C++):
1
2
3
4
5
6
7
namespace my_namespace {
  int a_function(int arg) { ... }
  void a_procedure(int arg) { ... }
}

using my_namespace;
a_procedure(1);  


and this (Java):
1
2
3
4
5
6
7
class MyNamespace {
  public static int aFunction(int arg) { ... }
  public static void aProcedure(int arg) { ... }
}

import static MyNamespace.*;
aProcedure(2);


or this (Scala):
1
2
3
4
5
6
7
8
9
10
object MyNamespace {
  def aFunction(arg: Int): Int = { ... }
  def aProcedure(arg: Int) { ... }
}

import MyNamespace._
aProcedure(3)

println(MyNamespace) // <--- yet everything is an object
println(aFunction _)  // <--- functions are objects, too 


IMHO, there are none. The differences are purely syntactic.

The last snippet of code is *additionally* object-oriented, which means you can pass the "namespace" as an object somewhere, but you don't need to do that. You can treat it just as a C++ namespace.
Last edited on
Pages: 1234... 6