Page 2 of 2 [ 24 posts ]  Go to page Previous  1, 2

wbport
Sea Gull
Sea Gull

User avatar

Joined: 16 Sep 2012
Gender: Male
Posts: 220

15 Dec 2012, 9:46 am

It's not exactly programming in the traditional sense, but GameMaker will give an idea of what is involved. The Lite version is a free way to get started and there are some summer camps that teach it.

I am retired from a career where I used COBOL. These days I create a few web pages and use JavaScript to illustrate ideas or run slide shows. It is client side only so there is no way visitors can log in and order things with a credit card (not that I have anything to sell).



Trencher93
Velociraptor
Velociraptor

User avatar

Joined: 23 Jun 2008
Age: 125
Gender: Male
Posts: 464

15 Dec 2012, 2:32 pm

wbport wrote:
I am retired from a career where I used COBOL.


I'm so sorry. You have my deepest sympathy.



UnLoser
Veteran
Veteran

User avatar

Joined: 28 Mar 2012
Gender: Male
Posts: 655

15 Dec 2012, 3:38 pm

I'm going to give my general impressions on the Java language. I've been programming in Java for 6 months now.

It's fairly simple and easy to learn(although all the mumbo-jumbo you have to type to get a simple program to work may confuse beginners, but at least you can more or less ignore it when starting off.), and Java IDE's can catch a lot of beginner errors as you type them(my first experience with programming was writing Python scripts in a text editor, so I didn't have that luxury). I actually think it's better for beginners than Python, as it's static typing system forces type compatibility to always be on your mind, and its static nature in general is easier to wrap your head around. But for an experienced programmer, it's not as good because it lacks expressive power compared to other interpreted languages. It's more verbose and is notably lacking in support for functional and meta programming styles. More than anything, I miss list comprehensions.



Vectorspace
Veteran
Veteran

User avatar

Joined: 3 Oct 2012
Age: 35
Gender: Male
Posts: 903
Location: Germany

15 Dec 2012, 6:38 pm

UnLoser wrote:
It's fairly simple and easy to learn(although all the mumbo-jumbo you have to type to get a simple program to work may confuse beginners, but at least you can more or less ignore it when starting off.), and Java IDE's can catch a lot of beginner errors as you type them(my first experience with programming was writing Python scripts in a text editor, so I didn't have that luxury). I actually think it's better for beginners than Python, as it's static typing system forces type compatibility to always be on your mind, and its static nature in general is easier to wrap your head around. But for an experienced programmer, it's not as good because it lacks expressive power compared to other interpreted languages. It's more verbose and is notably lacking in support for functional and meta programming styles. More than anything, I miss list comprehensions.

I agree on the first part, but I don't think experienced programmers should use interpreted languages so much.

Java is interpreted for compatibility and some "magic" features (namely reflection), but its (kind-of) static type system rather resembles compiled languages.
Interpreted languages with dynamic type systems (like Python) are very expressive, but they are slow, and even experienced programmers sometimes make mistakes. In a large project of millions of lines of code, that sums up to a lot of bugs.

The general-purpose language for experienced programmers is C++. It's fast (when done right) and its type system is static but also very expressive (again, if used right). Some concepts look a bit old-fashioned, but I don't see any real alternatives (beside Java and C#).



Evinceo
Deinonychus
Deinonychus

User avatar

Joined: 13 Apr 2012
Age: 32
Gender: Male
Posts: 392

15 Dec 2012, 8:05 pm

A good replacement for C++ is C, since many people are better off not using C++'s fine-grained control of object facilities. Also, Java isn't really interpreted, it's compiled as bytecode beforehand. Python is compiled into bytecode on the fly.

You can do reflection in C if you want, it's just really hard (since you you can do whatever you please with casting.)



UnLoser
Veteran
Veteran

User avatar

Joined: 28 Mar 2012
Gender: Male
Posts: 655

16 Dec 2012, 4:32 pm

Vectorspace posted:
I agree on the first part, but I don't think experienced programmers should use interpreted languages so much.

Java is interpreted for compatibility and some "magic" features (namely reflection), but its (kind-of) static type system rather resembles compiled languages.
Interpreted languages with dynamic type systems (like Python) are very expressive, but they are slow, and even experienced programmers sometimes make mistakes. In a large project of millions of lines of code, that sums up to a lot of bugs.


Do you really think that performance is a big issue for most professional applications? I mean, not every business application out there involves crunching a ton of data. Static error-checking is a good argument, though. I rarely make any type errors in Python, but I can understand that when a program gets large, you can have errors hidden in deep corners that won't pop up immediately. That's where static checking comes in.

The general-purpose language for experienced programmers is C++. It's fast (when done right) and its type system is static but also very expressive (again, if used right). Some concepts look a bit old-fashioned, but I don't see any real alternatives (beside Java and C#).

How about Scala as an alternative to Java? My impression is that it reaps most of the performance benefits of the Java VM because it compiles to bytecode, while being a lot more expressive.

Evinceo wrote:
A good replacement for C++ is C, since many people are better off not using C++'s fine-grained control of object facilities. Also, Java isn't really interpreted, it's compiled as bytecode beforehand. Python is compiled into bytecode on the fly.


Really, C as a replacement for C++? I was under the impression that C programs would generally be 3 times longer than an equivalent C++ program, mostly because of the lack of OO features. Have you found this to not be the case?



Vectorspace
Veteran
Veteran

User avatar

Joined: 3 Oct 2012
Age: 35
Gender: Male
Posts: 903
Location: Germany

16 Dec 2012, 7:39 pm

UnLoser wrote:
Do you really think that performance is a big issue for most professional applications?

C++ performance vs. Java performance? Not so much.
C++ performance vs. Python performance? Very much.

According to the Benchmark Game, C++ vs. Java is factor 1.7 in CPU time and factor 10 in memory (the ratio can be influence by Garbage Collector tuning, though). That's sometimes significant, sometimes not.
C++ vs. Python is factor 50 in CPU time factor 4 in memory.

UnLoser wrote:
How about Scala as an alternative to Java? My impression is that it reaps most of the performance benefits of the Java VM because it compiles to bytecode, while being a lot more expressive.

I should have mentioned that, yes. It's generally considered a little slower than Java, but not much.
It's especially useful for parallel computing.

UnLoser wrote:
Evinceo wrote:
A good replacement for C++ is C, since many people are better off not using C++'s fine-grained control of object facilities. Also, Java isn't really interpreted, it's compiled as bytecode beforehand. Python is compiled into bytecode on the fly.

Really, C as a replacement for C++? I was under the impression that C programs would generally be 3 times longer than an equivalent C++ program, mostly because of the lack of OO features. Have you found this to not be the case?

I don't consider longer to be the main problem.

In C, you always do malloc/free. Sometimes you forget to "free", sometimes you do it twice. In C++, you have the RAII principle, so you rarely have to allocate memory manually. And if you do, you can use an auto_ptr (or unique_ptr/shared_ptr in C++11).

In C, you can't write code that works for more than one type. Either you write it twice (which is a bad idea due to the redundancy), or you write it for the (void *) type (which is also a bad idea because it can lead to type errors). In C++, you have templates.

Generally, C++ provides features that allow you to write better code. Making use of them is up to you, though.



Vectorspace
Veteran
Veteran

User avatar

Joined: 3 Oct 2012
Age: 35
Gender: Male
Posts: 903
Location: Germany

16 Dec 2012, 7:52 pm

Evinceo wrote:
Also, Java isn't really interpreted, it's compiled as bytecode beforehand.

That's correct. If a piece of bytecode is run only a couple of times, the bytecode is merely interpreted. That is slow, but still faster than interpreting raw source code.
If the Virtual Machine notices a "hot spot" (i.e., a piece of code that is used regularly), the Just-In-Time (JIT) compiler is spawned, which compiles this piece of code into machine code, whose performance is more comparable to code written in languages like C++.
That's why Java often doesn't look so bad in benchmarks, but "feels" slow in interactive programs because JIT compilation takes some time.

The main problem I see in Java is that every object (except variables of primitive data types, which are not objects) is put on the heap and thus has to be garbage-collected. That consumes some time and wastes a lot of memory between the cycles (see my previous post).