Live data from Hacker News

Tips for Building High-Quality Django Apps at Scale

blog.doordash.com

41–50 of 125 posts

Re: Tips for Building High-Quality Django Apps at Scale

#41
post #30
post #19

Earlier quoted context omitted.

I agree with all of your points about the article, but... > However, they should take it a step further, and just avoid Django in the first place. Django is a tool, and like most tools it has a use. I find Django indispensable for writing specific kinds of applications, and it's admin interface is by far the best thing since sliced bread for internal/backoffice applications. It's not perfect by any means but it's ama…

> I'm not sure why you put quotes around migrations as if it's some alien, obscure or weird feature. If you've never written a web application that needs migrations then you're not writing the kinds of applications (or indeed any 'serious' application) that would benefit from Django IMO. I have been programming for almost 15 years, and have never once needed to use migrations. I have worked on projects for multiple y…

> I have been programming for almost 15 years, and have never once needed to use migrations.

> Have I ever had to add a column to a database? Absolutely,

... then you've used a migration. A statement like "I've never once had to use a migration" is so obviously incorrect that it's comical. Your contradiction two lines down makes it more so.

The rest of your comment is fairly misinformed about a few things, full of FUD, misses the point of Django migrations entirely and seems desperate to paint any use of migrations as the result of being a "bad programmer" rather than changing requirements or a natural part of development. Seeing as you've used migrations, you're a bad programmer as well.

As such I'm not going to bother writing a reply to the rest of it like I usually would.

Re: Tips for Building High-Quality Django Apps at Scale

#42
post #10

Earlier quoted context omitted.

I've got 10 years' experience on projects small and large and I have to agree. The title talks about building at scale but the article doesn't stress that which makes some of the advice downright weird. >If you don't really understand the point of apps, ignore them and stick with a single app for your backend. You can still organize a growing codebase without using separate apps. This is where the article lost me. If…

> Avoiding "fat models" is another place where it feels more like opinion than anything to do with performance or good design So in the Java world, the general pattern is that: Views: - Accept and sanitize query parameters - Call call one or more service methods. - Catch errors and return an appropriate error response - Render a JSON response based on the results of the service methods if nothing goes wrong. Service…

Yeah, I don't disagree with that at all. I came to Django from C# after playing with Ruby on Rails a little bit and the lack of an explicit Controller in Django confused me and I think it is part of the driver behind the "fat model" approach. I like the idea of the logic for the business object being inside it and all testable on its own but I think it has its limits-- thinking about my own Django codebases, the number of class/ static methods I have on models is a code smell from me learning OOP on C# where I had to stick those methods some place.

Re: Tips for Building High-Quality Django Apps at Scale

#43
post #37

Earlier quoted context omitted.

You get your DB model 100% correct the first time, always? Even years later your DB model is able to accommodate all those always changing business requirements?

Yeah, pretty much. Haven't had a problem yet where I needed automated migrations, and I have been doing this for years upon years upon years. Like I said, if you're leaving heavily on migrations, you're doing something wrong.

I'd like to know what I am doing wrong, as I use migrations all the time. The option is change the database later (and use migrations) or write a whole ton of crappy code to avoid using them. I have tried both ways and usually migrations work better.

Re: Tips for Building High-Quality Django Apps at Scale

#44
post #43
post #37

Earlier quoted context omitted.

Yeah, pretty much. Haven't had a problem yet where I needed automated migrations, and I have been doing this for years upon years upon years. Like I said, if you're leaving heavily on migrations, you're doing something wrong.

I'd like to know what I am doing wrong, as I use migrations all the time. The option is change the database later (and use migrations) or write a whole ton of crappy code to avoid using them. I have tried both ways and usually migrations work better.

I dunno what to tell you without specific details about your application and environment in general.

Clearly, you need a better system architecture if you're having to do migrations constantly.

Re: Tips for Building High-Quality Django Apps at Scale

#45
post #44
post #43

Earlier quoted context omitted.

I'd like to know what I am doing wrong, as I use migrations all the time. The option is change the database later (and use migrations) or write a whole ton of crappy code to avoid using them. I have tried both ways and usually migrations work better.

I dunno what to tell you without specific details about your application and environment in general. Clearly, you need a better system architecture if you're having to do migrations constantly.

I always thought a data model should be as agnostic to the system architecture as possible. Insofar I don't understand how a system architecture can help to avoid data model migrations.

Re: Tips for Building High-Quality Django Apps at Scale

#46
post #41
post #30

Earlier quoted context omitted.

> I'm not sure why you put quotes around migrations as if it's some alien, obscure or weird feature. If you've never written a web application that needs migrations then you're not writing the kinds of applications (or indeed any 'serious' application) that would benefit from Django IMO. I have been programming for almost 15 years, and have never once needed to use migrations. I have worked on projects for multiple y…

> I have been programming for almost 15 years, and have never once needed to use migrations. > Have I ever had to add a column to a database? Absolutely, ... then you've used a migration. A statement like "I've never once had to use a migration" is so obviously incorrect that it's comical. Your contradiction two lines down makes it more so. The rest of your comment is fairly misinformed about a few things, full of FU…

Oh please, tell me how I'm misinformed?

If you need a migration library because you added a column to your database, then you have a serious problem.

If you need a migration library because you don't know how to write SQL, then you have a serious problem.

If your data structure is truly changing that often, then you shouldn't be using a SQL database in the first place, and you have a serious problem.

Re: Tips for Building High-Quality Django Apps at Scale

#47

Earlier quoted context omitted.

Part of it is that Django has been around for quite a while now. It's maybe _the_ most succesful Python framework out there, so there are some paradigms that aren't common anymore but are hold-overs from years past. In particular, it pre-dates the current "microservice" trend and assumes a fairly monolithic environment. And I think "apps" _do_ make sense in certain contexts. Consider this situation: - I start a "poll…

The polls app example is given in the introductory Django tutorial...

Yes, that's what I said...?

Re: Tips for Building High-Quality Django Apps at Scale

#48

Earlier quoted context omitted.

Part of it is that Django has been around for quite a while now. It's maybe _the_ most succesful Python framework out there, so there are some paradigms that aren't common anymore but are hold-overs from years past. In particular, it pre-dates the current "microservice" trend and assumes a fairly monolithic environment. And I think "apps" _do_ make sense in certain contexts. Consider this situation: - I start a "poll…

The polls app example is given in the introductory Django tutorial...

[deleted]

Re: Tips for Building High-Quality Django Apps at Scale

#49

I'm so glad to see the mention of "app" directories here. I've only dabbled in Django development, but I've always thought the desire to divide things into apps didn't really make any sense. It felt like the developers of Django had said "well, intuitively, there must be some unit of reuse at this level" and then stuck the notion of apps in there in an attempt to provide that reuse. This seems to me to be somewhat un…

> why not make the reuse optional?

Well, it is optional. You can just not divide you stuff and place everything inside the main app. But notice the article recreates the same layer of reuse inside the main app, and got some extra problems because of it (renaming the tables is probably caused by this).

Django may need an extra paragraph at the tutorial, telling how it is ok to place everything on the main app when everything is application specific software, and how you should break generic functionality on other apps.

By the way, what would be reverse Dunning-Kruger?

Re: Tips for Building High-Quality Django Apps at Scale

#50
post #44

Earlier quoted context omitted.

I dunno what to tell you without specific details about your application and environment in general. Clearly, you need a better system architecture if you're having to do migrations constantly.

I always thought a data model should be as agnostic to the system architecture as possible. Insofar I don't understand how a system architecture can help to avoid data model migrations.

Data structure, both storage, and in-memory, are very much a part of architecture.
Post reply on HN