8 ms·
Ask HN: What is your favourite programming language? Why?
- ggm 9y agoImportant not to mistake fluency for favourite. I code mostly in python but I am attracted to lisp and Haskell. Because they have beautiful simplicity in the first case and interesting outcomes in the second. I continue to struggle to achieve expressiveness in either. Maybe before I die. But my real favourite is awk. Because it was the first language I used with a hash structure and so let me explore writing code which did content addressed things like count uniques over stdin string streams from logs. All kinds of languages had functions and procedures and fancy schmancy if then else but having dynamically sized data which indexed off data.. that was electrifying. Perl had them after and I suspect that in part accounted for it's popularity. Every scripting language since has too.
- odonnellryan 9y agoThere is this oddness between how programming in Haskell feels and programming in Python. Each time I go back to Haskell to try and learn a bit more about that environment, I find the mindset carrying over to what I write in Python.
- ggm 9y agoSomething to look forward to! Thinking in yield() generators goes naturally to composition of functions. That's about my limit.
- tome 9y agoI spent a few years as a Python developer followed by a few years working with Haskell. Now I've gone back to Python and I'm a much better Python developer because of my Haskell experience. In fact I think I'm even better than I would have been if I'd swapped my Haskell time for more Python time.
- ocdtrekkie 9y agoLet me earn myself a -4. I do my hobby code in VB .NET. VB6 was the first thing I learned, and whether I'm doing C++, C#, or PHP, whatever else I've ever used, I'm usually translating in my head what I want to do... from VB. So I've ended up back at VB after several years in other languages because it cuts out the cognitive load.
- krapp 9y agoProbably javascript. With the caveat that all of the work I've done in javascript has been of the old school "write it in a text editor and FTP it to the server" variety, and I have little real exposure to the modern ecosystem or the problems people seem to have with javascript at scale. I like the simplicity of the syntax. Arrays and objects are easy, closures are easy, and I like prototypal inheritance as a concept, although you're not supposed to actually use it in practice. Lua is probably a close second, though. If I were to design a programming language, it would probably be somewhere between the two, with some C++ features tossed in for flavor (operator and function overloading, maybe generics.)
- erikpukinskis 9y agoI second this. I love ES5. It was a beautiful, simple language. And it runs just the same on literally every device. The JavaScript community has taken a horrible turn towards complexity. I’ve been planning a fork of the npm tree, to return to ES5. But it’s a big project and I want to be ready with a good modern, modular web toolkit before I do. (The plan is not just to fork an ES5-compatible tree, but to allow people to rewind the npm tree to an arbitrary branch mask based on any linting rule they like and append from there. If you want to narrow to only typescript+react packages with named exports for tree shaking, you could. I’m gonna do good old fashioned ES5 though, no promises allowed and no assignment in global scope)
- thepapanoob 9y agoi understand your love for javascript... but i dont understand the hate for es6 & upwards. ive rewritten all my code to atleast es2015 and lost so much overhead while doing it wich makes my projects alot easier to maintain. (and alot more predictable) the only thing wich is lacking right now is native support for it in the browsers
- erikpukinskis 9y agoPromises introduce declarative control structures basically between every function call in an async application, which is a nightmare for debugging. ES6 introduces way more syntax, making it much harder for beginners to learn. Arrow functions make scope much harder to reason about, which makes closures more of an anti-pattern. In ES6 closures are one of a tiny number of scope patterns so you can actually use them. Arrow functions cause bind to break in unpredictable ways. Most other ES6 features are just syntactic sugar which offer no software engineering benefit and add a whole layer of conflicting code styles that one must constantly switch between, or else deal with constant pointless linting fixes if you are adhering to a consistent standard. ES6 demands you use a transpiler which makes debugging flakier, and adds another place for bugs and maintenance work, in addition to often slowing he build down. If I wanted deal with that much headache I’d just use typescript and at least get type checking in exchange for the syntax change and transpile step. ES6 exists because some programmers never understood prototype and bind. And felt naming a function that is only called once was icky. Mostly former Ruby programmers. So they bolted a shitty Ruby onto JavaScript in order to get people to stop using prototype and bind, which are the heart of JavaScript’s control flow. Basically the chest burster from Alien.
- vivekd 9y agoPython - because I suck at programming and it's easy - also because I don't do it professionally it's more of a hobby for me
- odonnellryan 9y agoDon't be too hard on yourself!
- brownbat 9y agoI think I subconsciously fell in love with Python because of something a bit silly... the bias towards keywords over symbols. I think there's some pattern recognition routine in my head that convinces itself we're reading prose, based on the ratio of words to symbols, so it feels comfortable for a amateur hobbyist like me. I know "bias towards keywords" isn't a functional language feature, but I think it is a nice UX. Of course, then I learned about generators and decorators in Python... Those are fun too.
- odonnellryan 9y ago"Thinking in Python" is a thing -- kinda. It's like "thinking in Lisp" or "thinking in Haskel." Each of these makes you a better programmer, in my opinion! Generators are certainly "thinking in Python."
- odonnellryan 9y agoPython. Just because of the community. There are amazing developers involved in every bit of the Python community, from machine learning libraries to web frameworks :) It's hard to find a problem that only has one Python library that solves it. Most of the time you have a dozen, and half of those are maintained better than I'd ever expect.
- Scarbutt 9y agoClojure, because of Datomic.
- gleenn 9y agoI have been meaning to try datomic for a while but love every minute of my current job doing Clojure. My company has been converting everything to it at every reasonable time, from web servers to massive ETL jobs to our Clojurescript React Native mobile apps. We've always been very happy with the conciseness of the code, the clarity gained from immutability and pure functions, the performance switching off Rails to the JVM and far easier parallel programming tools, and the ability to utilize the vast Java/JavaScript ecosystem if someone hasn't written something in Clojure itself. No ecosystem is perfect, but it has been the most charming environment I've worked with ever. Cursive rocks too!
- dfansteel 9y agoOkay, okay... I’ll be the lone Swift user. I really enjoy the type safety and in line parameter names on function calls. Of the type safe languages it feels like it has the minimal about of scaffolding needed to run some code.
- DividableMiddle 9y agoThe only issue I have is having to use Xcode.. has that changed since the last time I looked into it?
- bsaul 9y agoswift is really good. But swift-evolution makes me nervous.
- quickthrower2 9y agoHaskell. I like the power of using a powerful type system to get more guarantees when you compile your program. It's like getting additional unit tests with 100% code coverage for free.
- Zanni 9y agoPython. I'm an "infrequent" programmer, and I find the syntax sticks with me between projects, which is a huge time-saver. It's also the cleanest, most readable language I've ever programmed in, though I realize that's an extremely personal preference. Like brownbat, I have a bias for keywords over symbols. I'm also a huge fan of "explicit over implicit" and "there should be one right way to do it," which is why I favor Python over Ruby. The biggest win, though, as I've gotten more experienced with the language, is the ease and simplicity of "pythonic" programming--using iterators, generators and list comprehensions, favoring built-in data types (dictionaries, tuples and sets) over custom classes, and so on. My Python programs tend to be much, much shorter than what I'd write in C++ or C#, easier to read and quicker to write. Win, win, win for my purposes as I mostly don't care about speed ...
- Jedi72 9y agoElixir - 20 years of solid engineering design choices, battle tested to scale, with a nice new rails-like lick of paint.
- lvturner 9y agoBrainfuck - because of it's name.
- wallstquant 9y agoJulia lover here. I love having math at my fingertips and the ease of writing x’x\x’y. I like writing numerical code, knowing I can change types later and it will likely work. Still, I miss tab-tab from ipython for method completion from time to time and I work all day in mostly C++.
- Larrikin 9y agoKotlin. Less verbose than java, functional and modern features when I want them but doesn't implement every programming idea like scala. My second favorite language is python, but I like getting the type safety while writing way less code.
- gregopet 9y agoAnother vote for Kotlin - it strikes just the right balances for me in the functional vs. objective and verbosity vs. readability ranges. Its connection to Java brings a huge ecosystem of tools and libraries to the table, but if you don't need those, today Kotlin can also be used without Java or the JVM. It has been my main language for work projects for over a year now and I still love the language.
- wfbarks 9y agoswift, because it has a high level syntax with a really nice Generics implementation, but can still interface relatively easily with low level API's. Also because it uses reference counting for memory management instead of mark and sweep garbage collection so has more predictable performance and low memory overhead.
- tonyedgecombe 9y agoI've just started doing some Swift, I've been really impressed so far.
- psyc 9y agoC# is my favorite language as long as we're only talking about the language. It gets out of my way - I can write it without thinking consciously about the programming language. If the run-time didn't have garbage collection, it would be my ideal language. The GC never gets out of my way, ever.
- naveen99 9y agoTry autohotkey. One of the few scripting languages that doesn’t have a gc. Also good for lurker types in my opinion.
- blaisio 9y agoAt the moment, Go. I like the focus on features that make programmers happy, like `gofmt`. I love that most of the things I want to be able to do are already available as a library - it feels like Python in that regard. I really love how easy it is to cross compile for different platforms. I think they still have some issues with dependency management, but `dep` has made my life much better already. I love Rust as well, though I love it more as a concept than as an actual useful language. If only it weren't so freaking hard to get anything done in that language!
- peatmoss 9y agoRacket: it has the feeling of having been constructed by people much smarter than me, who are eager to help me get smarter myself. The docs and guide are a joy.
- chewxy 9y agoI've got two: I write and prefer to write code in Go. But when I'm in my thinking mode, I like and use Haskell a lot. I find Haskell clears up your thinking a lot, but it's really not great for production work. Go on the other hand is extremely great for prod work
- acutesoftware 9y agoPython is my favourite by far, mainly because when I first read over the syntax I typed in an ultra simple program and it worked first time. Normally, you would wrestle with constructors, imports / includes and semi colons in the appropriate places, but the fact that this program worked first time really impressed me. It has a beautiful clean syntax, which is as concise as I can imagine that a human readable language could get to giving instructions to a computer.
- zelah 9y agoMy favorite programming language is Zero (yes it is my invention). If you have not heard of it then I am not surprised because the language is very new (theoretical actually). You develop programs in it by defining new infinite sequences from existing ones. All begins with the primitive infinite sequences and the language's means of combination (specified with decimal digits) ---universe begin--- sequence 01: 0 1 2 3 4 5 ... sequence 03: 1 2 3 4 5 6 ... sequence 05: 2 3 4 5 6 7 ... sequence 07: 3 4 5 6 7 8 ... ... ---universe end--- 0105: count by two ---universe begin--- sequence 01: 0 1 2 3 4 5 ... sequence 02: 0 2 4 6 8 10... sequence 03: 1 2 3 4 5 6 ... sequence 05: 2 3 4 5 6 7 ... sequence 06: 1 3 5 7 9 11 ... sequence 07: 3 4 5 6 7 8 ... ... ---universe end--- 01030501: set up some cycles ---universe begin--- sequence 01: 0 1 2 3 4 5 ... sequence 02: 0 2 4 6 8 10... sequence 03: 1 2 3 4 5 6 ... sequence 04: 0 1 2 0 1 2 ... sequence 05: 2 3 4 5 6 7 ... sequence 06: 1 3 5 7 9 11 ... sequence 07: 3 4 5 6 7 8 ... ... ---universe end--- Please note that as the universe grows we always leave space for more sequences by skipping every other sequence designation. What makes this language useful is that with very little effort any two arbitrary infinite sequences can be defined. As a consequence any mathematical relation is easily defined as a mapping from members of one sequence to the corresponding members of the other sequence. I will briefly describe the language's means of combination. Writing a sequence designation one next to another will form new sequences by pulling out corresponding members. But all sequences are infinite so after the last designated sequence is visited the member value is used to select the possibly new member in the first designated sequence. Digits that are not able to be confused with sequence designations specify the three other primary means of combination. They are "cons", "car", "cdr". With a proper understanding of their use one can build arbitrary sequences. I will just say that "cons", "car", and "cdr" are used to combine entire sequences which is logically equivalent to combining corresponding members of those sequences. In the code above I write "0105". The "01" is a sequence designation. The "05" is a sequence designation.
- earenndil 9y agoHow do you define new sequences? What is the 'purpose' of this language -- that is, what can I do with it?
- 9y ago
- PaulStatezny 9y agoElm! (Currently.) I might have said Haskell, except I have very little hands on experience with Haskell. Elm is such a joy. Here are some reasons! 1. In the end, all your code is either functions or data! 2. There are only a few core concepts, and very little extra language features. There is zero implicit indirection. (E.g. macros or class inheritance.) As a result, it’s incredibly easy to reason about what the code is doing. 3. It’s incredibly straightforward to reason about what code is doing. Function bodies are just a single expression saying what the function returns. Functions are 100% “pure”; they don’t perform side effects, and when you pass in the same input you always always get the same output. I work in Elixir day-to-day. Elixir’s great, but just today I spent hours digging through internals of Phoenix (the prevailing web framework) to implement a “low level” abstraction in our application. Trying to understand the flow of code in Phoenix was painful! (Because a lot of advanced language features are used that bring more layers of indirection.) Not so in Elm. There’s no objects, no classes, no inheritance hierarchies. Everything is way more concrete and clear from the get go.
- dhruvkar 9y agoi'm just starting to learn elm. are there any cases where elm was not the ideal solution but js was?
- csciutto 9y agoClojure. Lisps in general are beautiful.
- Bombthecat 9y agoWork in project using grovy. I'm still amazed how much stuff is build in and don't need a plug-in or extension or need you to write your own function...
- matt_m 9y agoFor fun, Scheme/Lisp. Once you have macros it really feels like the sky is the limit in terms of what you can express. I've also been liking Go quite a bit recently. I know it's a language HN loves to hate. It's not as expressive as some other languages. But I feel like creativity within constraints can also be rewarding (kind of like writing a haiku). If I can find a way to reformulate my problem so that it can be expressed easily in Go, I'm often happy with the result. And because the abstractions Go provides are not very costly, it usually executes efficiently too. It's hard to find a language that combines high level features with the lower level features that performance-sensitive apps often need (like value types, control of memory layout, etc). Also GC simplifies a lot of things, and Go makes it practical for a wider class of applications with sub-ms pauses and making it easy to minimize allocations. C++/Rust involve more programmer effort around ownership, and C# can also involve more programmer effort since minimizing allocations is trickier and GC impact is greater. It's not a big language but the combination of features / trade offs seems really practical. Go's also widely used enough where you don't need to worry about having a robust library if you need HTTP2 or something.
- muzani 9y agoKotlin. Have been using it for a couple of years in production code. It does almost everything Java does, but with much less characters.
- fuball63 9y agoPython professionally. Use it every day at work and for side projects. My favorite "for fun" languages are TCL and Ada. TCL because of its simplicity and elegance, Ada because of its type system, oop model, and compiler.
- nils-m-holm 9y agoKlong and T3X, both invented by myself. Klong is a K-like array programming language that I use for all kinds of computations, statistics, and data analysis. T3X is a super-simple typeless low-level language that looks a bit like a cross between Pascal and BCPL. I have also written an awful lot of C code, but it gives me headaches way too often. See http://t3x.org http://t3x.org if you want to have a look at Klong, T3X, and all the other languages I have implemented or invented.
- willtim 9y agoHaskell. For programming with immutable values and pure functions, beautiful succinct syntax and strong types. Strong types ensure correctness, but in Haskell, they also help me reason about where and when my effects (such as IO) are happening, Haskell is now the current inspiration for many object-oriented languages like C# and Java: http://wadler.blogspot.co.uk/2012/09/brian-goetz-on-future-of-java.html?m=1 http://wadler.blogspot.co.uk/2012/09/brian-goetz-on-future-o...
- lowkeyokay 9y agoI still like sql. It’s just so intuitive: select this from that where something is true That’s the core of everything you do. I could write all day about what a mess it can become, and how awful debugging is. But I still enjoy it
- bonesss 9y agoF#: the syntactic power and delicious type system of OCaml combined with the coding ease of Python, all the best of modern C#, a runtime that's essentially a first rate JVM clone, all wrapped up an packaged by one of the better dev tool suppliers... It hits a real sweet spot for Enterprise coding, domain modeling, scientific computing, and cloud computing. It's the only way I'll touch legacy MS-ecosystem projects. The community is driven by open source and highly cross platform. It's also got type-checked scripting that makes 'plumbing languages' and utility scripts look second rate, for pragmatic day to day stuff, while maintaining complete access to the libraries and models of any of your systems. Potent stuff for people whose technical decisions are regulated (or even just subject to Enterprise Thinking by Important People).
- thepapanoob 9y agoi absolutely love D! its such a nice mixture of both worlds, you have the good things of a compiled language, the extensebility of C/C++ and the really handy things scripting languages provide :D it feels like a scripting language with the power of native speed and compability
- thiht 9y agoWhen I was a student, I learnt OCaml and loved it. Unfortunately there are very few opportunities to work with these kind of languages. So I tried my best to use some functional featured to the languages I work with, mainly JavaScript, and more recently Typescript which I really like. I started to look into Elm and might fall in love with it soon enough, if so I'll try my best to make my coworker love it too :) Tldr: OCaml in my dreams, Typescript in reality, probably soon to be replaced by Elm
- puredanger 9y agoI've used a lot of languages in my career, and Clojure is easily my favorite. I have never found anything else that comes close to being fun to use, getting the heck out of my way, and allowing me to solve real problems fast. The combination of generic data programming, sane state management, and access to host platforms with reach is a killer combo.
- tejinderss 9y agoIf you have to choose second best, which one would that be ?
- osullivj 9y agoMy fave lang to implement is Forth. Get hold of an old FIG listing and you'll find a tiny number of hand coded primitives in asm at the core. The threaded interpreter is simple and elegant. The resulting system is fast and extensible.
- itbeho 9y agoI'm having a ton of fun with Elixir these days. Primarily focused on utilizing Nerves and deploying sensors in agricultural environments monitoring irrigation, temperature and humidity.
- RSNews 9y agoI prefer Ruby. Ruby is convenient and powerful development environment. Firstly, let's talk about Ruby development speed, it increases by 30-40% in relation to any other language. And all points in the complex (security, professionalism of Ruby developers, eg, these guys: https://roobykon.com/solution/ruby-for-startups https://roobykon.com/solution/ruby-for-startups, verification of code validity, localization, etc.) make Ruby perfect programming language for the websites development.
- JuliaChernykh 9y agoIn my opinion, Ruby is the best one.It is a very convenient and powerful development environment.