Hacker News new | ask | show | jobs
by tahdig 2432 days ago
> ... many of whom are new to Python.

well, if you ask me to write language X, I would definitely make mistakes for the first couple of weeks/months/years, that is why you need code review, mentoring and education plans for your hires.

> Here’s another thing we often find developers doing at import time: fetching configuration from a network configuration source.

  MY_CONFIG = get_config_from_network_service()
I am pretty sure this an anti-pattern, if this code passed the code review, you should make your review process more strict.

  def myview(request):
    SomeClass.id = request.GET.get("id")
> Likely you’ve already spotted the problem

Well, yes, why would you do this? why would this pass code review? why do we we have linters and other checks for dynamic languages

> It works great for smaller teams on smaller codebases that can maintain good discipline around how to use it, and we should switch to a less dynamic language.

It seems we are here blaming python for shortcomings of a monolith also, instead of chunking out specific businesses modules to separate services/micro-services.

TO be honest the strict mode seems interesting, but I believe the problems they seem to be facing can be solved by a couple of changes to their pocess and code:

- everyone gets a mentor if they are not experienced in python or django

- code review atleast by two experienced python developers(does not count if you have coded for Java for 20 years)

- teams should try to move their logic outside the monolith(it sounds like they have a monolith)

- write CI tests to measure how much time it takes to import a file, if it takes more than T(line count * LINE_PROCESSING_THRESHOLD) you have to fix your code.

- prepare config and load it before running the actual server, no network call for getting config

All in all, python is suitable for big companies also, the thing is if don't care about the best practices, you would also have problems when you are a small startup, but in a big co it would make it impossible to move forward, trick is to independent of the company size follow best practices and have code review.

1 comments

That's a long post to say "do more code review instead of investing into technical solutions to technical problems".

Clearly, Instagram's solution saves them time. That means faster code reviews which incidentally makes them more accurate. Your post doesn't really make sense.