Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Programming and Hacking > Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th December 2008, 01:39   #1  |  Link
flebber
Practising Schemer
 
Join Date: Feb 2008
Location: Newcastle, Australia
Posts: 791
C++ or Java development gains losses

Hi

this is more of a general development question. I am looking to learn a programming language to further my work skills(not video related) but would like to be able to use my new skills with this(video) as a hobby.

I just wanted to know if there was any specific reason that most video applications here were developed in C/C++ over Java. Is it a speed or portability issue that is available when using the C/C++ environment or some other reason unknowns to me.

All thoughts appreciated.
flebber is offline   Reply With Quote
Old 11th December 2008, 04:09   #2  |  Link
Ábudos
Suspended for forum rule violations
 
Join Date: Jan 2007
Posts: 35
Well, both Java and C/C++ can be very portable.

C/C++ can be ported to any operating system depending on how you code it, that is, if you know you want to write with with multiple operating systems in mind, you'll have to keep that in mind when writing it.

Java code should* run on any system that supports the Java virtual machine (ie. windows, linux, OSX) with almost no changes to the code or even the compiled executable. This isn't always 100% true, but close.

People will say that Java is just as fast as C/C++ (some lunatics will insist it's faster) but the fact is that C/C++ offers you much more control over the application and more room for optimization (it's a lower level language than Java, running closer to the actual computer hardware), and when it comes to just raw data manipulation, C/C++ will be able to do the same things much faster than Java.

Because of this Java is technically easier to program, with less work on your part. Speed and control vs simplicity and speed of writing the program are kind of you basic trade offs.

If you are new to programming, my suggestion would be to learn C, then once you understand it, learn the additional functions that you get with C++. These languages are much more commonly used in the programming industry and I think you'll go further with the knowledge you gain.


Hope this helps.
Ábudos is offline   Reply With Quote
Old 11th December 2008, 08:43   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,405
I personally used c++ for sx264 instead of java (which I'm more used to program with and I still want to test 'Qt Jambi') since:
a. I wanted to refresh my c++ programming skills
b. the point about the industry more liking C++ Ábudos made is true
c. a lot of people kind of 'want/expect' a .exe file under windows (I know there are ways to archive this with java but that always seemed like a hassle to me unless you use a non-Java installer anyway)
To learn a new language I would recommend C++ or C# or Java since they are all object oriented and kind of similar (it's not so hard to switch between them).

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 11th December 2008, 09:51   #4  |  Link
flebber
Practising Schemer
 
Join Date: Feb 2008
Location: Newcastle, Australia
Posts: 791
Yeah Selur I had noticed yours developed in C++ and that Avidemux was also developed in C++. Satxrip and Megui are using .net framework so that is like C# isn't it. If it is then surely it can't a far stretch from c++.

Abudos I am not quiet game to start in at C, if I start at C++ it shouldn't be to hard to learn C (hopefully), but yeah I do love optimization and I haven't used to many Java based encoders or tools so I think I should start in at C++.
flebber is offline   Reply With Quote
Old 11th December 2008, 10:23   #5  |  Link
Ábudos
Suspended for forum rule violations
 
Join Date: Jan 2007
Posts: 35
Quote:
Originally Posted by flebber View Post
Abudos I am not quiet game to start in at C, if I start at C++ it shouldn't be to hard to learn C (hopefully), but yeah I do love optimization and I haven't used to many Java based encoders or tools so I think I should start in at C++.
It's completely backward to try and learn C++ and then C. To lean C after C++, you'd have to un-learn things, whereas going from C to C++ is essentially just adding on a few new tricks. It would be the natural progression of things to first get a good grasp on C, and then learn the differences in C++. A lot of C++ code can be valid C code, but all C code is valid C++ code.

Last edited by Ábudos; 11th December 2008 at 10:27.
Ábudos is offline   Reply With Quote
Old 11th December 2008, 12:21   #6  |  Link
flebber
Practising Schemer
 
Join Date: Feb 2008
Location: Newcastle, Australia
Posts: 791
Thats definitely a valid point(a bit of a bugger in some ways - I had planned to put it off til later). Did you teach yourself C from a book/s, if yes could you point me in the direction of the book that helped you most with C. What certification did you get for C/C++ ?

Last edited by flebber; 11th December 2008 at 12:23.
flebber is offline   Reply With Quote
Old 11th December 2008, 15:48   #7  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,251
Quote:
Originally Posted by flebber View Post
Satxrip and Megui are using .net framework so that is like C# isn't it.
Microsft's .NET Framework is very similar to Java. The source code is compiled to an intermediate bytecode, which then is executed in a virtual machine (or compiled "just in time" at runtime). So .NET very much has the same pro's and con's that Java has. BUT: You can use .NET on Windows only. There is Mono for Linux, but it's not 100% compatible (yet), I think. I read MeGUI won't run on Mono. One pro for .NET is: It's not bound to one language. You can use C#, J#, VisualBaisc.NET, Delphi.NET, etc. and even combine these in one app. Another pro for plain C/C++ over Java/.NET is that you can ship all the libraries with you app or even link them statically. No additional software will be needed to run your app. While .NET and Java always require the user to install a bloated Runtime Environment (Java JRE, .NET Framework).

BTW: I personally prefer the Delphi way (Delphi 7.0, not Delphi.NET). It's very convenient to created decent GUI's, produces stand-alone EXE's and still can be very low-level.
So it's like C++ with native GUI support. It's Bound to Win32/Wine though. There was Kylix for Linux, but I think it never became very popular and has been dropped...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 11th December 2008 at 15:56.
LoRd_MuldeR is offline   Reply With Quote
Old 11th December 2008, 21:46   #8  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
Quote:
Originally Posted by LoRd_MuldeR View Post
One pro for .NET is: It's not bound to one language. You can use C#, J#, VisualBaisc.NET, Delphi.NET, etc. and even combine these in one app.
C++ is a language, .NET is an environment, so this is not a good comparison. Although not commonly done, multiple compiled languages can be used in a single project, and is supported by Visual Studio, Developer Studio, etc. Most languages have ways to declare the language or calling mechanism of externals. One big example is the calling mechanism for Windows itself, it is not the native C/C++ mechanism, but Pascal.
mpucoder is offline   Reply With Quote
Old 11th December 2008, 22:14   #9  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,251
Quote:
Originally Posted by mpucoder View Post
Quote:
Originally Posted by LoRd_MuldeR
One pro for .NET [compared to Java] is: It's not bound to one language. You can use C#, J#, VisualBaisc.NET, Delphi.NET, etc. and even combine these in one app.
C++ is a language, .NET is an environment, so this is not a good comparison. Although not commonly done, multiple compiled languages can be used in a single project, and is supported by Visual Studio, Developer Studio, etc. Most languages have ways to declare the language or calling mechanism of externals. One big example is the calling mechanism for Windows itself, it is not the native C/C++ mechanism, but Pascal.
You totally miss the context! The comparision was between the .NET Framework and the Java Runtime Environment primarily. Both, Java and .NET, are Runtime Environments. While the Java Runtime Environment is limited to the Java language and only runs Java Bytecode (compiled from Java source code) on it's JVM, the .NET Framework is not limited to a specific programming language. You can use C#, J#, VisualBasic.NET, Delphi.NET and so on. Basically everything that compiles to the CIL (Common Intermediate Language) will run on .NET's CLR (Common Language Runtim) properly. And indeed you can mix all of the .NET-enabled languages freely, because they share a common type system. That fact is an important difference between Java and .NET, so why should the comparison be no good?

http://upload.wikimedia.org/wikipedi...rinzip_ext.svg
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 11th December 2008 at 22:46.
LoRd_MuldeR is offline   Reply With Quote
Old 12th December 2008, 00:30   #10  |  Link
SledgeHammer_999
Registered User
 
Join Date: Aug 2005
Posts: 138
[offtopic]
Quote:
Originally Posted by LoRd_MuldeR View Post
So it's like C++ with native GUI support. It's Bound to Win32/Wine though. There was Kylix for Linux, but I think it never became very popular and has been dropped...
[/offtopic]

There's always wxWidgets which uses the native widgets in each OS.
SledgeHammer_999 is offline   Reply With Quote
Old 12th December 2008, 00:49   #11  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,251
Quote:
Originally Posted by SledgeHammer_999 View Post
[offtopic][/offtopic]

There's always wxWidgets which uses the native widgets in each OS.
Of course there are various GUI Toolkits. Besides wxWidgets there are also Qt and GTK+ for example.
My point was that Delphi doesn't require any additional libraries/toolkits to create a GUI. Instead it comes with native GUI support that deeply integrates into the language and the IDE.
A simple standalone Delphi executable can be ~200 KB in size, while the Qt runtime libs alone are 14 MB in size...

Also using native controls on each OS makes cross-platform a nightmare! GTK+ and Qt can provide the same Look&Feel on all platfroms, emulating what's not available natively.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 12th December 2008 at 00:51.
LoRd_MuldeR is offline   Reply With Quote
Old 12th December 2008, 00:37   #12  |  Link
Ábudos
Suspended for forum rule violations
 
Join Date: Jan 2007
Posts: 35
If you're considering Java, then it's only logical to also present the .NET environment and all of it's constituent languages.

I've never done much in java, but I know it's very similar to C# which is a language I've used for a few projects.

The real debate is managed code vs unmanaged code. Managed being anything .NET (C#, C++/CRL, VB.NET) and Java. The idea behind managed code is that your program doesn't compile into actual machine code (which are the instructions that actually get processed by the CPU) but instead to an intermediate, platform independent pseudo instructions. This byte code is then processed on the fly by the runtime environment and turned into real code for the CPU. The overall advantages of managed code is that if the operating system in question has a working version of the runtime environment, your compiled programs will run. The runtime environment also has a whole plethora of built in functions for you to use, which means you can perform complex tasks with relative ease. This of course comes with the price of speed. Simplicity for speed is a trade off worth making for a lot of simple projects that aren't major data crunchers and performance critical, so it has it's place. Managed languages like C# are also very much GUI native which means making a GUI program in them is very easy.

Unmanaged code would be C/C++, Delphi, and Assembler (ASM) to name some popular ones. They give you the most control and overall the best number crunching performance. Assembler is as low level as you can go, and if you know assembler you can actually see a direct correlation between C/C++ code and ASM. C/C++ gives you almost as much control as ASM while expediting the most commonly used aspects and making it easier to read for humans. You can even put ASM code inline with C/C++ code. With C/C++ you have very fine control over the operation of the program, full access to the Win32 API, and can easily import functions from other existing libraries.

I recommend C/C++ as the best unmanaged language and C# as the best managed, with unmanaged code being more ideal for video work. If you are interested in C# I still recommend visiting C/C++ first as it is also an easier transition to go from C/C++ to C# then the reverse.

Last edited by Ábudos; 12th December 2008 at 00:40.
Ábudos is offline   Reply With Quote
Old 12th December 2008, 00:56   #13  |  Link
Ábudos
Suspended for forum rule violations
 
Join Date: Jan 2007
Posts: 35
wxWidgets and GTK+ are most commonly found in applications that started as under GNU/Linux and were then ported to windows.

You could also always take a GTK+ app and rewrite it to use windows native GDI, it's just a bit of extra work.

The great thing about C/C++ is that it can do everything and anything. GUI, CLI, multithreading, you name it. Because of it's simplicity and the fact that nothing is built into the language it's not bound by any limitations. The only cost being that it requires a bit more work to implement complex features, but not necessarily difficult.
Ábudos is offline   Reply With Quote
Old 12th December 2008, 03:15   #14  |  Link
JohnnyMalaria
Registered User
 
Join Date: Sep 2006
Posts: 602
As a slight aside, for my hardcore, performance-gobbling stuff, I use C++ (unmanaged). I tend to create things with COM interfaces. I *hate* creating the UI in C++ (WTL) - so time consuming. So I often use VB .NET to create UIs for the C++ COM stuff. You can quickly bang out lightweight apps that way. Heck, sometimes I write DLLs in C++ and use Excel's VBA with them!
__________________
John Miller
Enosoft DV Processor - Free for personal use
JohnnyMalaria is offline   Reply With Quote
Old 12th December 2008, 05:30   #15  |  Link
flebber
Practising Schemer
 
Join Date: Feb 2008
Location: Newcastle, Australia
Posts: 791
removed poorly worded question

Last edited by flebber; 12th December 2008 at 06:03. Reason: poorly worded
flebber is offline   Reply With Quote
Old 12th December 2008, 05:32   #16  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
You should know by now that we don't ask for "best" around here.
Guest is offline   Reply With Quote
Old 12th December 2008, 05:56   #17  |  Link
flebber
Practising Schemer
 
Join Date: Feb 2008
Location: Newcastle, Australia
Posts: 791
Quote:
Originally Posted by neuron2 View Post
You should know by now that we don't ask for "best" around here.
Yes I poorly asked the question I agree.

I should have said a compiler eg visual c++ borland dev-C++ that would suit a beginner but not be limiting as I improve.

My concern with the visual studio is managed extensions and well that its a microsoft product(not a fair call) but real to me. Really Visual C++ in managed extensions is a good thing I assume as it gives C++ garbage collection and automated memory management.

Stroustrups list http://www.research.att.com/~bs/compilers.html has only compilers known to conform to the standard which he places high value on is there any other considerations i should take into account when choosing..

Last edited by flebber; 12th December 2008 at 06:04.
flebber is offline   Reply With Quote
Old 12th December 2008, 07:14   #18  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
Do you want to tinker with video filters? Or write video editing applications?

There is just not enough complexity in most video filters to warrant giving up the control/efficiency you get with C for a higher level language, most of the time goes into tinkering with the algorithm anyway ... not the actual coding. For writing filters I'd go with C with enough of C++ to understand avisynth and do some "simple" template tricks.

For anything above the filter level though I don't think C(++) is worth the bother ... use Java, C# or even Python. Even then if you want to interface directly with existing image/video processing code you can't really get away from having to learn C and a little bit of C++ ...

Last edited by MfA; 12th December 2008 at 07:19.
MfA is offline   Reply With Quote
Old 13th December 2008, 09:19   #19  |  Link
flebber
Practising Schemer
 
Join Date: Feb 2008
Location: Newcastle, Australia
Posts: 791
Well I am going to start with C++, I am teaching myself so I got a book by Jesse liberty, Sidhhartha Rao and Bradley Jones. I am going to use the Microsoft Visual C++ environment and see how it goes I guess I can always try Borland or Dev-C++ if its not so good.
flebber is offline   Reply With Quote
Old 14th December 2008, 05:11   #20  |  Link
Ábudos
Suspended for forum rule violations
 
Join Date: Jan 2007
Posts: 35
Quote:
Originally Posted by flebber View Post
Well I am going to start with C++, I am teaching myself so I got a book by Jesse liberty, Sidhhartha Rao and Bradley Jones. I am going to use the Microsoft Visual C++ environment and see how it goes I guess I can always try Borland or Dev-C++ if its not so good.
Microsoft's compiler is the best for Windows, I've had nothing but headache trying to get things like DirectX and other things working in Dev-C++. Save yourself the trouble and stick to Visual C++ on Windows and GCC for Unix OSes.
Ábudos is offline   Reply With Quote
Reply

Tags
c++, development, java

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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


All times are GMT +1. The time now is 03:39.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.