Fav language?

Put your programming skills to the test in these challenges.

Fav language?

Post by pretentious on Mon May 13, 2013 6:30 am
([msg=75581]see Fav language?[/msg])

So no doubt this question has been posted before. the answer is usually along the lines of there is no 'best' language. Each have their strengths and weaknesses. but a recent thread here got me thinking that a lot of the big ones out there actually aren't made for anything in particular and i would think, provided the context is clearly established, It's fair to draw a comparison.

I was on http://projecteuler.net/ back in the day and took a crack at mission 7, which is to find the 10,001st prime number. I solved this in C++ coz that was the language i was playing with at the time . Now here's the question, which language would you use to solve this challenge? it's purely mathimatical and only requires one integer as an output. I'm pretty sure any language worth mentioning is more than capable of implamenting a solution without too much trouble, so methinks it's just a matter of personal taste. Thoughts?
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
pretentious wrote:Welcome to bat country
User avatar
pretentious
Contributor
Contributor
 
Posts: 577
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: Fav language?

Post by fashizzlepop on Mon May 13, 2013 11:54 am
([msg=75582]see Re: Fav language?[/msg])

Depends on your goal. With this easy of a problem, C++ code would not be very bulky. Therefore the argument of a scripting language over C or C++ is moot. C++ code would undoubtedly run faster than a python script. Another thing to consider is if you want to thread it to further optimize speed. A language like Go might be better at this than C++.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: Fav language?

Post by centip3de on Mon May 13, 2013 2:35 pm
([msg=75583]see Re: Fav language?[/msg])

I'd most likely do it in C, because if I'm going to be going through that many numbers, I'd want it to run as efficient as possible (granted a decent algorithm is used). I also may or may not have an extreme love for programming in C...
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Moderator
Moderator
 
Posts: 1412
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Fav language?

Post by pretentious on Tue May 14, 2013 8:51 am
([msg=75587]see Re: Fav language?[/msg])

the goal is to find the solution. if I recall right, it took maybe one to two seconds to get to the solution on the computer that I was using. thing is I had all day to figure out how to code it and it took me long enough but the actual program itself only needed to run correctly once to give me an answer

-- Wed May 15, 2013 12:56 am --

interesting though how efficiency seems important in your choices. would syntax or object oriented v procedural carry much weight?
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
pretentious wrote:Welcome to bat country
User avatar
pretentious
Contributor
Contributor
 
Posts: 577
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: Fav language?

Post by centip3de on Tue May 14, 2013 3:53 pm
([msg=75589]see Re: Fav language?[/msg])

pretentious wrote:interesting though how efficiency seems important in your choices. would syntax or object oriented v procedural carry much weight?


I'm not entirely sure I'm fit to answer this question as my favorite languages to code in because of their syntax are C and ASM, which also just happen to be two of the most efficient ones out there.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rick Cook
User avatar
centip3de
Moderator
Moderator
 
Posts: 1412
Joined: Fri Aug 20, 2010 5:46 pm
Blog: View Blog (0)


Re: Fav language?

Post by LoGiCaL__ on Tue May 14, 2013 6:37 pm
([msg=75591]see Re: Fav language?[/msg])

I'm myself did this one in C++. As fas stated it really isn't bulky so personally I chose procedural over object oriented. I mean if I'm going to be coding a and I know A). the program is going to be a few hundred lines or greater or B) the program is going to require a good amount of functions, variables and a little more complex than usual I would go with OO just for the organizational aspect of things. As far as efficiency I'm not 100% sure if procedural has an advantage over OO or vise versa.
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1060
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)


Re: Fav language?

Post by mShred on Tue May 14, 2013 7:39 pm
([msg=75594]see Re: Fav language?[/msg])

That's actually really funny that you asked that. Just this weekend I went back onto my projecteuler account (ask LoG, we were doing some code comparison on one of the missions). Last time I was on PE, I was pretty much coding strictly in Perl and did a small amount of missions. Then coming back to it a year or two later, I figured I'd code everything in PHP. So that's exactly what I did. I did about nine or so missions that night. That said, I did use PHP. Which obviously isn't gonna be as quick and efficient as C or C++, but it does the job just fine. With this, I absolutely base the time and efficiency off the code itself though. Especially when it comes to working with large numbers and long loops.
I do wish I would try to brush up on my C knowledge, as it would be a lot better for things like this. While I was coding a couple of them, I really wanted to keep everything as efficient as possible. And running a compiled language would help just that much more. But I do enjoy my PHP and it was working pretty well for me.
pretentious, if you're getting back into project euler, you should hop on IRC (#coffeesh0p) and bull shit with us. I'd be down to do some coding with you (or anyone else for that matter).
But yes: favorite language changed from Perl to PHP.
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1680
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)


Re: Fav language?

Post by 3vilp4wn on Thu May 16, 2013 3:18 pm
([msg=75614]see Re: Fav language?[/msg])

I'd go for python if it doesn't *have* to be crazy efficient. Yes, C++ would be faster, but it wouldn't be a huge difference. That said, I did make a prime number generator in C++ once, so I could reuse that, but I'd rather port it to python.
Do not mistake understanding for realization, and do not mistake realization for liberation
Evil Ninja Hackers
???
٩(͡๏̯͡๏)۶

1A4EAMboaXpgvUSmtRbVRqbfJrbyuGhyoo
User avatar
3vilp4wn
Poster
Poster
 
Posts: 144
Joined: Sun Feb 10, 2013 2:05 am
Location: The darkness.
Blog: View Blog (0)


Re: Fav language?

Post by -Ninjex- on Fri May 17, 2013 4:49 am
([msg=75630]see Re: Fav language?[/msg])

Kind of funny, me and KthProg had a challenge between the two of us on who could build the fastest prime number calculator (he still hasn't finished his)

I built mine in C++, however, if I knew C I would probably program it in that (I am currently in the process of reading "C Primer Plus") Anyways, for efficiency, the main thing to note is that the closer you are to actually programming in "machine language", if coded to it's maximum efficiency, the faster the program should run.

As for my favorite language, I would have to go with PHP right now. It's very diverse, not overly complicated, and can get most jobs done, and it's not really slow; however, it's also not the fastest.
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1204
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Fav language?

Post by fashizzlepop on Mon May 20, 2013 11:30 am
([msg=75706]see Re: Fav language?[/msg])

When I first did the 40 or so PE missions I've done, I did it in Perl. Haven't gone back over them since, but if I did it'd most likely be Python or Go.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests