You are not logged in.

#1 2019-04-06 08:13:10

chrisdb
Member
Registered: 2018-05-16
Posts: 95

[SOLVED] Java alternative

Hello,

I'm looking for a decent general alternative to Java.

I know Python is a great language, but is it still worth learning for like f.e. web development or is python more focussed on AI?

Or are there reasons for not using Python and maybe something else, like f.e. Golang?

Thx

Last edited by chrisdb (2019-04-28 19:31:37)

Offline

#2 2019-04-06 08:57:35

dmerej
Member
From: Paris
Registered: 2016-04-09
Posts: 81
Website

Re: [SOLVED] Java alternative

It depends on what you are trying to do. It would be easier for us to help you if you said why you are looking for a Java alternative.


Responsible Coder, Scrum Master, Buildfarm Guru, Python3 Fan
twitter: @d_merej mastodon:@dmerej@mamot.fr

Offline

#3 2019-04-06 09:14:41

Morn
Member
Registered: 2012-09-02
Posts: 602

Re: [SOLVED] Java alternative

Python is great for processing and visualizing data in science and as a glue language. I suppose that is also how it became so dominant in AI research. But it is also a nice general purpose programming language. Web development also works, but perhaps JavaScript, TypeScript, PHP, etc. would be better for that.

Go is more for servers and other applications where a lot of parallel processing has to happen. It may be great for Google, but apart from that its popularity seems to be declining.

I would also learn C, at least the basics of it. It teaches you so much about how a computer really works at the hardware level and is still quite popular, e.g. the Linux kernel or embedded systems. It is also a very small language, so it will not take you months to learn. On the TIOBE index (https://www.tiobe.com/tiobe-index/) it ranks #2 behind Java and before Python, so that tells you something.

Offline

#4 2019-04-06 10:38:30

chrisdb
Member
Registered: 2018-05-16
Posts: 95

Re: [SOLVED] Java alternative

I just want to expand my knowledge by learning something different than Java and just want to be sure I don't invest in something which doesn't have a certain future.

Morn wrote:

I would also learn C, at least the basics of it. It teaches you so much about how a computer really works at the hardware level and is still quite popular, e.g. the Linux kernel or embedded systems.

I thought C wasn't recommended anymore in favour of c++

Offline

#5 2019-04-06 11:14:23

Morn
Member
Registered: 2012-09-02
Posts: 602

Re: [SOLVED] Java alternative

chrisdb wrote:

I thought C wasn't recommended anymore in favour of c++

20 years ago, C++ was supposed to take over and C was considered old hat. But in recent years, C has become very popular again, while C++ has lost mind share.

I think this is because there are many languages like C++ for writing GUI apps, while there is no real alternative to C for "twiddling bits". Arduino uses C which probably helped a lot too. Plus, C++ is huge compared to C; too much to keep in your head all at once. Finally, computers are so much faster today, so GUIs can be done in Python too without causing performance problems.

C++ is interesting with its templates and STL, but I think it is in the same category as Common Lisp now: intellectually stimulating to learn, but of limited practical use.

Offline

#6 2019-04-06 11:18:03

chrisdb
Member
Registered: 2018-05-16
Posts: 95

Re: [SOLVED] Java alternative

Morn wrote:
chrisdb wrote:

I thought C wasn't recommended anymore in favour of c++

20 years ago, C++ was supposed to take over and C was considered old hat. But in recent years, C has become very popular again, while C++ has lost mind share.

I think this is because there are many languages like C++ for writing GUI apps, while there is no real alternative to C for "twiddling bits". Arduino uses C which probably helped a lot too. Plus, C++ is huge compared to C; too much to keep in your head all at once. Finally, computers are so much faster today, so GUIs can be done in Python too without causing performance problems.

C++ is interesting with its templates and STL, but I think it is in the same category as Common Lisp now: intellectually stimulating to learn, but of limited practical use.

Interesting...
So how would you go about using a rest server in C?

Are there any existing frameworks in C for this?

Last edited by chrisdb (2019-04-06 11:18:21)

Offline

#7 2019-04-06 12:48:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

chrisdb wrote:

So how would you go about using a rest server in C?

The same as you would in any other language.  Connect to the appropriate server (using "connect") and read and write (using "read" and "write" ... and likely "select").

chrisdb wrote:

Are there any existing frameworks in C for this?

Probably.  And they probably suck.  But if you want to learn C, ditch the word "framework" and learn about a few useful libraries.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#8 2019-04-06 12:52:37

chrisdb
Member
Registered: 2018-05-16
Posts: 95

Re: [SOLVED] Java alternative

Trilby wrote:
chrisdb wrote:

So how would you go about using a rest server in C?

The same as you would in any other language.  Connect to the appropriate server (using "connect") and read and write (using "read" and "write" ... and likely "select").

chrisdb wrote:

Are there any existing frameworks in C for this?

Probably.  And they probably suck.  But if you want to learn C, ditch the word "framework" and learn about a few useful libraries.

Ok I meant writing a REST service smile

Offline

#9 2019-04-06 13:12:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

Ok, then replace 'connect' with 'bind' and 'listen'.  All the same still applies.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#10 2019-04-06 13:17:45

progandy
Member
Registered: 2012-05-17
Posts: 3,491

Re: [SOLVED] Java alternative

If you don't want to start from scratch, there is e.g. libmicrohttpd to create embedded web servers. If you search on github, you'll probably find some projects that use it to implement a REST service or even a REST service library.

Edit: Hey. A language discussion thread without mentioning Rust as the future for web applications? Blasphemy! (that is sarcasm, btw) Seriously, it might not be a bad choice, though.

Last edited by progandy (2019-04-06 13:32:41)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#11 2019-04-06 13:26:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

Perhaps this will highlight why I suggested ditching the word "framework".  In language ecosystems with "frameworks" you often need to chose between different frameworks that combine dozens of libraries.  So you can use the framework that is good at A and bad at B, or the other that is good at B but can't do A.  Programmers who use "frameworks" are then often compelled to do everything that framework's way - often frameworks are more of a cult than a software tool.

In C, people generally talk about libraries, and the libraries you use are determined by your goals.  If you need to listen on a internet socket, the standard libraries are more than sufficient with functions including socket, bind, listen, accept, read, write, etc.  If you want to specifically interact with http/web clients, there are libraries that help out there as noted above.  If you intent to exchange data between client and server in json, there are json parsing libraries available.  If your server will need a database, there are libs for sqlite, mariadb, mongo, etc, etc, etc.

Frameworks are like kits for building model airplanes: you are given the parts and are expected to build exactly what that framework was intended to build.  You may get to chose colors or some minor details, but that kit only builds one kind of thing.  The various libraries available for languages like C is more comparable to legos: you pick and chose which legos you need to build what you want.

---

On another note, while I love C, if your goal is web application development, it may not be the most reasonable choice.  C is great for web servers, and can certainly provide web "apps", but there are other languages more suited to the web app role.  PHP is worth knowing, but python may really be the best choice for these goals.  Sadly there you do get back into the world of "frameworks" like flask, bottle, cherrypy, etc.  Some of these are quite good - but they are still a bit cultish in design.

Every language has it's strengths.  For example, java's strength is in allowing introductory programming classes to focus on topics of design and algorithms without the student actually learn to program in a language that they should ever use in the real world tongue

Last edited by Trilby (2019-04-06 13:31:04)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#12 2019-04-06 13:29:35

Morn
Member
Registered: 2012-09-02
Posts: 602

Re: [SOLVED] Java alternative

I am not sure if I would trust C for web applications, with its propensity for buffer overflows and all that. But then again you don't have to make every little programming experiment accessible to the whole Internet, so behind a firewall it might be fine.

progandy wrote:

Edit: Hey. A language discussion thread without mentioning Rust as the future for web applications? Blasphemy! (that is sarcasm, btw) Seriously, it might not be a bad choice, though.

The Rust hype and the Go hype seem to have gone to the same place, wherever that may be. /dev/null I guess. smile

Offline

#13 2019-04-06 13:33:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

Morn wrote:

I am not sure if I would trust C for web applications, with its propensity for buffer overflows and all that.

That's not a propensity of the language, but of programmers who write in it without realizing it will do what it is told and nothing more when said programmers are used to languages / compilers that engage in far too much hand-holding.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#14 2019-04-06 13:36:25

progandy
Member
Registered: 2012-05-17
Posts: 3,491

Re: [SOLVED] Java alternative

Trilby wrote:

That's not a propensity of the language, but of programmers who write in it without realizing it will do what it is told and nothing more when said programmers are used to languages / compilers that engage in far too much hand-holding.

Don't forget external effects like deadlines that may make you rush and forget validating your values here or there.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#15 2019-04-06 14:07:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

Sure, but blaming that on the language is still not justified.  Being absent minded with scissors can be quite dangerous, but I'd bet that few people here have only those kindergarten safety scissors in their homes - in fact, I'd bet few people have those style of scissors at all!  Despite being pretty safe, they're not very useful.

Last edited by Trilby (2019-04-06 14:07:47)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#16 2019-04-06 14:12:42

Morn
Member
Registered: 2012-09-02
Posts: 602

Re: [SOLVED] Java alternative

Trilby wrote:
Morn wrote:

I am not sure if I would trust C for web applications, with its propensity for buffer overflows and all that.

That's not a propensity of the language, but of programmers who write in it without realizing it will do what it is told and nothing more when said programmers are used to languages / compilers that engage in far too much hand-holding.

Possibly, but I think when somebody comes from Java one should point out the pitfalls of manual memory management. C is wonderful if you can trust your input data. Which is not really the case for network applications in particular.

Even by 1960s/1970s programming standards, the idea in C that a string is simply a pointer into memory without a maximum length, just something you read from until you encounter a zero, was pretty silly. Literally the single bad design decision that launched a million buffer overflows.

Offline

#17 2019-04-06 16:40:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

That cannot cause a buffer overflow.  Using a fixed region of memory and copying an unknown length of data into it can - this is just as true in any language as it is in C and it's really a bit of a strawman - a competant C programmer would not do this.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#18 2019-04-06 17:27:24

chrisdb
Member
Registered: 2018-05-16
Posts: 95

Re: [SOLVED] Java alternative

Trilby wrote:

On another note, while I love C, if your goal is web application development, it may not be the most reasonable choice.  C is great for web servers, and can certainly provide web "apps", but there are other languages more suited to the web app role.

Trilby, I'm interested to know what your view is on C++?

Offline

#19 2019-04-06 19:29:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

Probably quite similar to Morn's, though he managed to state it quite tactfully.  Every language has strengths and weaknesses, but frankly, C++ seems to consolidate the weakness of many with very few strengths.

If you want to be "close to the metal" and have more control (and responsibility) for every detail for systems programming, use C.  If you want a powerful language that still lets you have a higher level of abstraction with a good ecosystem of libs and frameworks for things like "app" development, use python.  If you want a language that will suck at all of these tasks, use C++ wink


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#20 2019-04-06 23:32:07

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 3,380

Re: [SOLVED] Java alternative

Trilby wrote:

Sure, but blaming that on the language is still not justified.  Being absent minded with scissors can be quite dangerous, but I'd bet that few people here have only those kindergarten safety scissors in their homes - in fact, I'd bet few people have those style of scissors at all!  Despite being pretty safe, they're not very useful.

Hey!

I've got a nice set that do either wavy, crinkly or straight. They're brilliant smile


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#21 2019-04-07 11:17:16

bart_vv
Member
From: Poland
Registered: 2011-04-12
Posts: 51

Re: [SOLVED] Java alternative

Trilby wrote:

That's not a propensity of the language, but of programmers who write in it without realizing it will do what it is told and nothing more when said programmers are used to languages / compilers that engage in far too much hand-holding.

Trilby wrote:

Sure, but blaming that on the language is still not justified.  Being absent minded with scissors can be quite dangerous, but I'd bet that few people here have only those kindergarten safety scissors in their homes - in fact, I'd bet few people have those style of scissors at all!  Despite being pretty safe, they're not very useful.

Are you a die-hard C fanatic? The presented view has been repeatedly debunked by showing that even experienced C programmers write vulnerable code. We are humans and we do make mistakes, especially in mundane and recurring tasks. Tools (including compilers, runtimes) that do the verification for us are a step in the right direction, and their performance overhead is being continuously minimized.

Trilby wrote:

That cannot cause a buffer overflow.  Using a fixed region of memory and copying an unknown length of data into it can - this is just as true in any language as it is in C and it's really a bit of a strawman - a competant C programmer would not do this.

True, a competent C programmer would not do this. At least today, because now everybody knows about these types of errors and security vulnerabilities they can introduce. In the distant past, maybe even some experienced C programmers knew about it. Still, by the presence of such functions (strcpy) in the standard library we can infer that (back then) experienced C programmers decided that it was good idea and it would be broadly useful (and you just said it isn't). Hell, the C standard library is full of things that today we would think of them as extremely stupid, e.g. localtime returning value in global buffer thus being thread unsafe. And I agree with Morn that null terminated strings was a sad and silly mistake.

Morn wrote:

Python is great for processing and visualizing data in science and as a glue language. I suppose that is also how it became so dominant in AI research. But it is also a nice general purpose programming language. Web development also works, but perhaps JavaScript, TypeScript, PHP, etc. would be better for that.

Python's dominance in AI is relatively recent (10 years?), I think scientists mostly used MATLAB, R etc. before (of course, I have no data to support that). And as far as I know, Python had some share of web development world shortly after the start of the century. JavaScript and PHP have some flaws (there must be some reason why people tend to joke about them...), I personally would state that Python is actually better for web development! I never understood why node.js would be beneficial besides using a huge JS workforce for backend. Don't know about TypeScript.

Offline

#22 2019-04-07 13:17:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 22,031
Website

Re: [SOLVED] Java alternative

I'm convinced.  Lets go rewrite the linux kernel and coreutils in Java.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#23 2019-04-07 15:31:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 16,702

Re: [SOLVED] Java alternative

I will say one thing of my adventures in C++, it helped me learn to write better C code through better use of structs  to provide some of the benefits that C++ provides in classes.
Now, I tend to write most things that are speed critical in C, almost everything else in Python.  Java is reserved for Android programming.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#24 2019-04-08 07:24:23

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 484
Website

Re: [SOLVED] Java alternative

Trilby wrote:

I'm convinced.  Lets go rewrite the linux kernel and coreutils in Java.

A weak argument to support a weak stance.
Nobody suggested to rewrite an entire kernel of millions of LOC in such an abstract language.
However it may not be a bad idea to consider migrating some certain parts of the kernel to Rust.
I remember a video, that can be found on YouTube labelled "The tragedy of systemd" in which the speaker also mentions the common problems with C on a side note.

Online

#25 2019-04-08 09:01:09

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 876

Re: [SOLVED] Java alternative

I don't believe in the "one glove fits all" approach. Use the right tools for the right job. Some of my preferences:

Web: Node.js, ASP.NET Core, Go
Cross-platform UI: QT (C++)
Scripting: TypeScript, Bash, Python
Kernel, drivers, console apps, integrated devices: C
Mobile apps: Java, Swift
ML, science: Python

Last edited by karabaja4 (2019-04-08 09:05:18)

Offline

Board footer

Powered by FluxBB