d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need Help Finding Some Info
Add Reply New Topic New Poll
Member
Posts: 4,981
Joined: Sep 26 2008
Gold: 109.00
Sep 9 2017 12:32pm
I had an image about how many lines of code you would need in python to do the same in Java and C++ but I can't find it anymore and my buddy has asked me how do the languages compared. Even though I told him Python requires less code to do the same C++ I would love to show him a chart. Would anyone have a picture of such chart?

Thank you
Member
Posts: 3,028
Joined: Mar 23 2016
Gold: 7,568.50
Sep 9 2017 03:55pm
I don't think you can make a comparison like that, different languages are good at different things, and it's impossible to settle on an objective "typical" piece of code for a given language to be measured.

What you could do is go on rosettacode.org and compare the code for a few common tasks.
Member
Posts: 4,981
Joined: Sep 26 2008
Gold: 109.00
Sep 9 2017 06:20pm
Quote (annexusquam @ Sep 9 2017 05:55pm)
I don't think you can make a comparison like that, different languages are good at different things, and it's impossible to settle on an objective "typical" piece of code for a given language to be measured.

What you could do is go on rosettacode.org and compare the code for a few common tasks.


Yes thank you that is what I was looking for, I might have worded it wrong but I wanted to show my friend like X lines of C++ code and how much lines would it take in Java to do the same and so on and so forth in other languages.
Member
Posts: 18,865
Joined: Apr 5 2008
Gold: Locked
Warn: 80%
Sep 9 2017 08:46pm
Quote (annexusquam @ 9 Sep 2017 14:55)
I don't think you can make a comparison like that, different languages are good at different things, and it's impossible to settle on an objective "typical" piece of code for a given language to be measured.

What you could do is go on rosettacode.org and compare the code for a few common tasks.


Agreed, while one launguage may require less code for same output, the resources required to parse the data can vary drastically including which fuctions are called for


For example (parsing)

Lang1

1+1+1
=3

Lang2
1+1+1
=2+1
=3

Lang3
(1)+(1)+(1)
=(2)+(1)
=(3)

Lang4 [xor]
(1)+(1)+(1)
=(2)+(1) ~ (1)+(2)
=3 ~ 3
=check ^
=3

Etc

This post was edited by death_knight on Sep 9 2017 08:47pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll