Live data from Hacker News

Ask HN: What made you change your mind about a programming language/paradigm?

news.ycombinator.com

291–300 of 401 posts

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#291
post #81

Using it as my main language: Python (2.7). How the hell did this thing become so popular? I've used it for all sorts of stuff earlier, less complex than the other. Scripts, devops, ETL... But then I got into a company that is using it for some quite serious stuff, a large codebase. Holly smokes this thing does not scale (in terms of development efficiency and quality) well. I swear at least 70% of our bugs is becaus…

You are using Python2.7 in 2019. there is your problem.

I understand if you inherited/maintaining a legacy application, you may not have had a choice about 2.7, but if it's a significantly large project and you are not making any attempts to use Python3 (and many of the improvements that come with it, including optional typing as one commenter mentioned, don't blame language, unless you have a solution that is magically going to fix all the problems from a language that is pretty much in "maintainance-mode! please use the new version" mode).

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#292

Earlier quoted context omitted.

I quit around 2.2, never looked back. Python was a breakthrough scripting language ... in the 90s.

Realistically, how could you know if it's still any good if you haven't used it since 2.2? It's basically a different language now.

The same way everyone else does: fixing other people's broken code. It actually hasn't changed much since 2.2.

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#293
post #81

Using it as my main language: Python (2.7). How the hell did this thing become so popular? I've used it for all sorts of stuff earlier, less complex than the other. Scripts, devops, ETL... But then I got into a company that is using it for some quite serious stuff, a large codebase. Holly smokes this thing does not scale (in terms of development efficiency and quality) well. I swear at least 70% of our bugs is becaus…

Growing a Python codebase like you would a Java/C# one (i.e. with tons of classes, interfaces, factories etc.) is a sure way to pull your hair out.

However, Python provides a bit of metaprogramming that could drastically reduce the number of LOC needed, should you write it in a Pythonic way.

That is, experienced Python programmers could write concise and performant Python code in less or at worst equal time as experienced Java/C# programmers. But if you hire Java/C# devs to write Python code, I can see how you could arrive at your conclusion.

Bonus video: https://www.youtube.com/watch?v=o9pEzgHorH0

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#294

Having worked with .Net for many years, I always had a bad feeling expanding my experience with a closed source, Windows-only platform (I liked the C# language and tooling, though). I kept looking for an open source, cross platform language with the same features and characteristics as .Net. .Net Standard and .Net Core being open source (MIT licenced), cross-platform, more performant than .Net Framework and Mono and…

I really enjoy C#, .Net and VS features, but man VS2017 has been broken for a while. Numerous 5 year old bugs either not fixed or coming back. (SQL Schema compare not authenticating, Intellisense not working, compilation errors not displaying in the errors window, winforms designer messing up form layout when opened on high DPI screens, slowness and freezing on medium-sized projects and decent hardware, the list can…

MS resources and focus are now on VS Code. Which is a shame because I'm sure the market for companies that pay VS Pro/Enterprise + Resharper is not small

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#295
post #232

Immutability. I didn't really understand the benefits of having immutable data structures until I tried building a service with no mutations whatsoever... and noticed I didn't get any weird, head-scratching bugs that took hours to reproduce and debug. That led me to go down the Functional Programming rabbit hole - thus changing my entire view on what code is/could be. [edit: spelling]

Here's a "me too:" I'm working on a small-ish Java application with a couple of former FORTRAN developers. Last Thursday we got a bug report from our integration testers saying that some data from earlier messages was showing up in later, unrelated messages. Sure thing, the data buffers are objects being re-used with mutation rather than being built from scratch per new message. Immutable objects, or a kind of "FP li…

I feel like Rust has shown that mutability is ok, as long as you don't have both mutability and aliasing. Having a mutable object accessible from many places at the same time definitely is a recipe for bugs.

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#296
post #255

Earlier quoted context omitted.

> Then I found out that -white space is important-. I hear this a lot and I think it's a misunderstood statement. Python does not care if you do not have a space in assignments or arithmetic or between commas or parentheses. What Python does care about is the indentation of the source code. The indentation is what guides the structure - which is already what we are doing with most languages that don't care about inde…

>which is already what we are doing with most languages that don't care about indentation! No that's not what the other languages are doing. They have explicit structure defined in the code (with Lisps being at the extreme end), which allows the development environment to automatically present the code in a way that's easy to read . This frees the developer from the job of manually formatting their code like some sor…

> No that's not what the other languages are doing.

Is this a claim that people do not indent in other languages and leave it to the dev environment? Yes, those languages don't rely on indentation but people do still manually indent or rely on their environment to indent it for them to make the code remotely readable. I for one cannot read Java without it also being indented correctly.

> This frees the developer from the job of manually formatting their code like some sort of caveman.

I honestly don't understand this part. What tools are you using that don't do indentation for you? Emacs and vim extensions, vscode, Pycharm, atom...all of them have very intuitive indentation for when you type. The most you have to do is hit backspace after finishing a block.

> Especially considering it's so easy to fix Python the language so that indentation becomes unambiguous: add an "end" statement for each deindent (aka closing brace).

As someone with a lot of Ruby experience, the "end" is absolutely not more clear than indentation. There's a reason environments highlight do-end pairs together: because it's hard to know which ones match which.

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#297

Testing. Unit testing to me seemed akin to drinking 8 glasses of water every day. A lot of people talk about how important it is for your health, but it really tends to get in the way, and it doesn't seem to really be necessary. Too frequently, code would change and mocks would need to change with it, removing a good chunk of the benefit of having the code under test. Then I started writing integration testing while…

> Unit test suites would break all the time for silly reasons, like someone optimizing a function would mean a spy wouldn't get called with the same intermediary data, and you'd have to stop and go fix the test code that was now broken, even though the actual code worked as intended. Can you or others speak more about this? I was taught that verifying function calls for spies/mocks was good practice. But, I encounter…

What should be tested is that the function does what is promised to the caller. Which other function it uses to accomplish this task is a detail, which should generally not be part of this promise (encapsulation). So either the effects of the function must be returned by the function, or it is a side-effect, which must then be observable in some other way. Example: If a function is supposed to create new user, don't check that it calls some internal persistence or communication layer with some User info. Instead list the users in system before and after, check that the correct one was added. Try to make an action as this new user. This forces you to expose (a view of) internal state at the API surface, which makes the system more observable, usually very beneficial for debugging and fillings gaps in API.

Also, many of the assertions that are often put into unit-tests (especially at stub/mock boundaries) are better formulated as invariants, checked in the code itself. Design-by-contracts style pre/post-conditions is a sound and practical way of doing this. When this is done well, you get the localization part of low-level unit testing even when running high-level tests. Plus much better coverage, since these things are always checked (even in prod), not just in a couple of unit tests. And it is more natural when refactoring internal functions to update pre/post-conditions, since they are right there in the code. When a function disappears they also do.

I don't like the term "integration" tests though, as they hint at interactions between systems being the important thing to test. Integration between services / subsystems are just as much a detail as internal function calls. If using the real system during test is too complicated or slow, maybe it should be simplified or made faster? Only when that is not feasible do I build a mock.

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#298
post #88
post #81

Using it as my main language: Python (2.7). How the hell did this thing become so popular? I've used it for all sorts of stuff earlier, less complex than the other. Scripts, devops, ETL... But then I got into a company that is using it for some quite serious stuff, a large codebase. Holly smokes this thing does not scale (in terms of development efficiency and quality) well. I swear at least 70% of our bugs is becaus…

I started using python 3 with mypy, which provides (optional) static typing, and my gosh has it reduced the time I spend looking for stupid problems by orders of magnitude. I got a somewhat direct comparison when I mypy-ified a small program where I used a lot of async and await (basically implementing own event loops and schedulers, it was interfacing very custom hardware that handled very different but interacting…

as a serious question, why even use python if you have to go through hoops to make it work even half as well as other languages? are you reliant upon some python only library?

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#299
post #83
post #81

Using it as my main language: Python (2.7). How the hell did this thing become so popular? I've used it for all sorts of stuff earlier, less complex than the other. Scripts, devops, ETL... But then I got into a company that is using it for some quite serious stuff, a large codebase. Holly smokes this thing does not scale (in terms of development efficiency and quality) well. I swear at least 70% of our bugs is becaus…

I think dynamically types languages are on their way out. There aren't many good arguments remaining in favor of them.

I think the dynamic/static typing dichotomy is on its way out (finally!). In dynamic languages optional/gradual typing is getting adopted (ex: Typescript/Flow for JS, Mypy for Python). In static languages type inference is getting standard (ex: Rust/Scala/Kotlin, auto in C++11).

Re: Ask HN: What made you change your mind about a programming language/paradigm?

#300
post #144

Static Type Checking. I used to think Node.js was the greatest thing ever. I won't bother explaining the benefits but suffice it to say I much prefer writing a server in Java compared to node. I think it takes getting burned at least once for new developers to understand why a lot of seasoned developers like types. Over time I've realized that there's a simple principle that applies to a lot of stuff in software and…

Good insights. Modern platforms are neither full dynamic nor rigidly static, but gradual, https://en.wikipedia.org/wiki/Gradual_typing . Start with a dynamic script, add typing as you go to strengthen the system. Notable mentions: Typescript, Python + mypy, C#, Dart.

you missed a big one: racket
Post reply on HN