Maybe this is just a symptom of working in a field with plenty of work opportunities, or the fact that I am not American, but the idea of a company demanding that I relocate in order to be closer to an office is comical at best.
I don't think it is farfetched to say that, for the good and bad, modern software development is moving away from a single project having to handle "1200 tables". As we see the growth of "services" (gasp, microservices!), the scope for codebases is reduced, hence why the pattern in my post (OP here) is so common to see in Go. Are Go developers masochists? No... But when you're working on (micro)services and your immediate work only touches 5 tables and the relationship between them, it's really not inconceivable to just reach for a database adapter and simple abstractions.
I'm going to propose, really just out of my butt so to speak, that most Go apps that use databases nonetheless are themselves middleware kinds of services that are involved with software infrastructure, as opposed to what we might call "business cases". That is, American Express might have a bunch of Go services that are deriving data from small configurationally-oriented databases all around the organization, but "the database with everyone's account information and credit card statements" is absolutely not a five table DB with a single Go application on top of it. 1200-table databases at the center of business cases will continue to exist, it's just Go applications are not themselves centralized business applications, Go is currently an infrastructure language (I googled around for this conjecture and it's obviously debated, but is still a pretty prevalent assertion I can find being made a lot). The boring business stuff is still in places like Java, Python, C#, etc.
> I swear the majority of these opinion posts against ORMs are from people who must have worked in a badly implemented project that left them with a bad experience and they blamed the pattern rather than the technology.
Fair. But you then proceed to detail a personal experience on the other side of the spectrum: Badly written code, without an ORM, and how it was fixed by introducing an ORM.
I think we can all agree that you can write bad code, with or without an ORM :). Not that this is entirely relevant to my post, I am simply advocating for writing more SQL, not how to write a good object mapper. That's a different beast, and I purposely kept that simple just to illustrate that it is possible to get started without too much pain.
My point with the personal anecdote is precisely that you can write bad or good code with both. however that an ORM can allow for more consistent experience across many more people.
My point is different than your takeaway. In my point I’m not blaming the technology, I’m blaming the people involved with using it in production.
I specifically point out that a well versed engineer can write a SQL based system well. An ORM just means I can diffuse that responsibility over multiple people more reliably.
> My point with the personal anecdote is precisely that you can write bad or good code with both. however that an ORM can allow for more consistent experience across many more people.
I find it interesting that you say that; my takes is that it's the other way around!
SQL join statements look the same no matter what programming language the reader is used to, but each ORM differs in the way the join looks to the reader. The EF method of filtering your results set in C# looks very different indeed to how the ORM for Python would do it.
Every ORM looks different, which results in a very inconsistent experience for people, especially when you bring in a DB expert to figure out why there's a slowdown somewhere, and he cannot just visually inspect the EF/SQLAlchemy code and say "Well, here's what's wrong".
DB experts can usually very easily do that just by looking at the SQL, no matter what programming language was used.
DB experts tend to be the minority though. It’s about indexing (pun intended) on the expert experience vs the generalist experience.
Often those may be very competing goals , where nativeness to the primary language used by the team might be more important than the nativeness of the expert.
Sure, but if you’re working in a sqlalchemy codebase, you should really learn enough sqlalchemy to get by. I don’t jump between languages and frameworks and expect a consistent experience but ideally I’d have an experience streamlined for the context.
If you’re a db expert that’s doing drive-by optimisation of queries in sqla then you can print them to see what’s going on - is that not broadly what you’re concerned with in your original comment?
> Badly written code, without an ORM, and how it was fixed by introducing an ORM.
Funny how those anecdotal bits never get published, eh? Its always "I shaved my db requirements in half by actually understanding what was going on because my orm is magic". Odd, innit?
First of all, thank you for SQLAlchemy! If I ever had to make a final choice in how I would interact with a database for a very large project that involves a considerable dev team, I would always bet on SQLAlchemy. Not that I would necessarily like all aspects of it, but when it comes to Python and SQL - “Nobody ever got fired for picking SQLAlchemy.”.
With that out of the way, despite ORMs doing much more than "just writing SQL", it is exactly on that point that I flinch: Most devs should be exposed to SQL. And if your project allows you to build around simple enough abstractions so that you aren't reinventing the wheel, you should definitely be writing SQL. Especially if you don't know SQL yet - which is the growing case of new devs coming into the job market.
You can achieve a lot with SQlAlchemy Core, a tool that I absolutely recommend, but my post is just a simple alternative to get developers to think about their approach. If that results in some devs reconsidering using "full fat" SQLAlchemy and to try SQLAlchemy Core, that's a win for me!
Your gist tries to highlight the difficulty of doing certain things without an ORM. Migrations (as just 1 example) doesn't need to be hard, simple tools like flyway, or migrate (https://github.com/golang-migrate/migrate) achieve a similar result (while also keeping you on the path of writing SQL!). Deep and complex relationships between objects also don't need to be hard - typically people approach this subject with a requirement to be very flexible in the way they want to build queries and objects, but that to me in a sign that maybe they should reconsider their business logic AND reconsider that, just maybe, their project doesn't require all that flexibility, it is fairly straightforward to extend objects and introduce some more complex representations as and when it is needed - will all of this make me write code faster? Absolutely not. That is why you have spent so much time perfecting SQLAlchemy, but then again, I am not advocating for devs to go and replace their usage of ORMs, just presenting an alternative that may or may not fit their needs for a new project + give devs the chance to learn something that the ORM might have taken away.
> This is just reimplementing Djangos ORM, bud badly.
I guess this is a good thing, as "reimplementing" Django's ORM is the opposite of what I wanted to do here :)
> ORM queries compose. That's why [Python] programmers prefers them. You can create a QuerySet in Django, and then later add a filter, and then later another filter, and then later take a slice (pagination). This is hugely important for maintainable and composable code.
I don't really disagree, but there are many ways to skin a cat. You can absolutely write maintainable code taking this approach. In fact, I can build highly testable, unit, functional, code following a abstraction very similar to this. The idea that "maintainable and composable code" can only be achieved by having a very opinionated approach to interacting with a database, is flimsy. I offer a contrary point of view: With the Django ORM, you are completely locked in to Django. You build around the framework, the framework never bends to your will. My approach is flexible enough to be used in a Django project, a flask project, a non web dev project, any scenario really. I want complete isolation in my business logic, which is what I try to convey just before my conclusion.
Djangos ORM isn't highly opinionated. That's just wrong.
> With the Django ORM, you are completely locked in to Django
Another bit of nonsense again. You have a dependency. Sure. Just like you have a dependency on Python. But it's an open source dependency, and the ORM part is a tiny part that you can just copy paste into your own code base if you want.
Also, worrying about being "locked into" something that you depend on is madness. Where does it end? Do you worry about being "locked into" Python? Of course not.
> You build around the framework, the framework never bends to your will.
You don't actually seem to understand Django at all. It's just a few tiny Python libraries grouped together: an ORM, request/response stuff, routing, templates, forms. That's it. You do NOT need to follow the conventions. You can put all your views in urls.py. You can not use urls.py at all.
You do NOT bend to the frameworks will. That's just false. You bend to it by your own accord, don't blame anyone else on your choice.
> Djangos ORM isn't highly opinionated. That's just wrong.
It's a fully featured ORM... Including migrations, query API (which is HIGHLY opinionated, it looks nothing like SQL), supports async (via asgiref!), custom model definition... It's almost the definition of opinionated. Not that you can build a fully featured ORM without being opinionated. That's not a dig at Django btw.
> Also, worrying about being "locked into" something that you depend on is madness. Where does it end? Do you worry about being "locked into" Python? Of course not.
Ermm, my premise is that you DON'T have to depend on it. It's not that crazy to not want lock in when it comes to the software that handles my database. Other programming language communities seem to handle that just fine.
The rest is a bit too ad hominem for my liking, so I'll pass.
This is also why I really like Peewee in Python. If I am not going to write SQL, at least give me an API that looks and feels like it. When I look at Peewee code, I can often see the end result query.
There are a multitude of extra things to consider, but none of those things are, in my opinion, imperative to having success with SQL in Python. Will it be hard to achieve the same level of convenience that modern ORMs provide? Absolutely. But there is always a cost.
I firmly believe that for most projects (especially in the age of "services"), an approach like this is very much good enough. Also, a great way to onboard new developers and present both SQL and simple abstractions that can be applied to many other areas of building software.
Agreed, I've seen plenty of what wind up being very byzantine and complex migration strategies over the years, and in the end simple SQL scripts tends to work the best. I will note, that it's sometimes easier to do a DB dump for the likes of sprocs, functions, etc, if you want the "current" database bits to search through.
> The load also depends on unique characteristics of the home like the amount of insulation or the type of windows and doors. A home built in 1850 with no insulation requires more energy than a brand new home. The load is just a technical way to describe and measure all of this.
No kidding. The site is all about switching from carbon, which I am all for, as would anyone that cares even slightly about the planet.
BUT. If you do live in a 1850s house with no insulation, getting a heat pump is a colossal waste of money that will not do the job. No matter how many fancy biased graphs and numbers someone comes up with.
Any responsible heat pump installer will firstly look at your home to determine if a heat pump is remotely feasible. Unfortunately, in the UK, only very recent new builds can comfortably accommodate a heat pump. That or older properties that have had CONSIDERABLE insulation work done to them (and I am talking the expensive kind like internal/external wall work, not just the easy jobs like loft insulation).
Be very careful with heat pump cowboys, if you are getting quotes that don't include a site inspection, run.
Could you elaborate a bit? My parents live in a not-very-well insulated wooden house from around 1900, and use a heat pump as their primary means of heating the house. This is Scandinavia, so it might be that this house (despite not even coming close to modern insulation standards) still has better insulation than most British houses, but it would surprise me (older British houses are generally built in brick, which should provide a better base level of insulation than a wooden house, and I'd think Britain isn't warm enough that nobody would build a house without any insulation whatsoever).
Maybe I don't understand what you mean by the word "feasible" – they don't have a goal of getting their living room above 23 C at most in winter, and I guess heat pumps are insufficient in such a house if you desire ambient temperatures above that. However, while other means of heating could plausibly bring the temperatures higher, that would end up being very expensive also because of the poor insulation – it's just harder in general to heat a drafty house and keep the temperature up, and I don't see how heat pumps are a uniquely bad choice for homes like that.
Edit: This is coastal Norway, so the climate in winter is quite similar to somewhere like Edinburgh, with temperatures usually above 0 C in January. The heat pumps would probably be insufficient somewhere the temperatures regularly reach -10 or -20 C, but that's a very infrequent event both here and in the UK.
British houses generally have terrible levels of insulation and if built before roughly 1930 are likely solid walled, so have no wall cavity to insulate. There is also the issue that a lot of people live in terraces and semis and there may simply be no suitable place to install a heat pump. When I looked into it for my house a couple of years ago the fitters basically said they couldn't do it because of lack of space.
There isn't that much to elaborate on. Commercial heat pumps just aren't good for the average UK house. They would be "alright" if the costs weren't prohibitive.
I don't know the specifics of your parents. A "wooden house" with a heat pump acting as the primary heating system in a country like Norway sounds fairly bad on the surface. But I don't know the insulation specifics, nor do I know what other heating element might come at play when the heating pump fails to keep up with the heat loss. Also, what heating pump are we talking about?
Heat pumps work extremely well in the Nordic countries and are therefore very popular. That's because due to the cold winters houses are already well insulated, though very old houses less so. Which means the houses are in general reasonably energy efficient to start with, so a heat pump providing 3.5-6kW of heat is generally sufficient. That would be to the main area of the house, so yes the heat pump is the primary heating system (for those who use them) in the sense that it's the heater used for the main parts of the house - think living room, kitchen area. There may well be normal electric heaters in other rooms, if deemed necessary, but other rooms (food storage, bedrooms etc) don't usually need much, if any, heating).
Of course in the Nordic countries you also have areas very far from the ocean, and there it can get very cold. Down to -50C in some cases, and regularly -30C or colder. I imagine heat pumps aren't used much there. But elsewhere (i.e. most places) they are great. In those places you see them absolutely everywhere now.
As long as the heat pump was properly sized for such an uninsulated home it would still heat it more efficiently than a resistive element heater and just as completely. Of course, if saving money is what you want to do, then yes, insulate before throwing dollars at anything else.
I'd argue that insulation should be the first thing people consider unless they know their home is already well insulated. It's all very well having energy efficient heating systems but if most of the heat generated leaks straight outside then I'd question whether that's efficient overall. Particularly in smaller dwellings, you can reduce the amount of heating you require each day during winter - often to nil.
In theory I'd agree that you should insulate first. But as others have pointed out, on some older houses, insulation can be difficult to accomplish (especially true in non-wood-framed housing). In such cases it is still a better idea to use LESS energy (because of a COP above 1) to heat that space than it is to use resistive or combustion methods (which have a COP less than 1).
Yes, it's more efficient than resistive electric heating, but in the UK that is typically not the alternative it's being compared to. The usual existing heating system would be a gas-fired central heating boiler, and the cost of gas vs cost of electricity means that gas is still cheaper, I think.
The costs are totally prohibitive, though. We're talking tens of thousands of pounds, whatever direction you decide to take.
You could spend 10s of thousands of pounds in a "properly sized" heat pump system. Or you could spend 10s of thousands of pounds in insulating your home + a more moderate heat pump.
Insulation always pays for itself in the long run, but the period of payoff like peruod of payoff on a mortgage - 10-20 years. We need very generous finance on making home improvements
The key issue is despite claims that cold doesn’t affect heat pumps it absolutely does. We have an old house. When very cold the heat pump struggles to put out enough heat. It works well enough, but something to be aware off - go bigger in system than you think you need maybe
Untrue. All modern heat pump systems use DC motors ("inverter technology") and will run continuously at variable speed until target temperatures are exceeded by a (programmable) margin. They do not turn on and off and on and off.
> I dont understand how heat output from a heat pump vs heat output from a gas / oil / wood burner / resistive heater are at all different.
A gas/oil/wood burner are not 100% efficient in creating heat, and release carbon into the atmosphere.
A resistive heat is at most 100% efficient: all the electrons go to making the coil glow, like old school light bulbs. So 1 kW of electricity is 1 kW of heat (which has some BTU equivalent for old fashioned folks).
A heat pump does not create heat, but moves it from one place to another with refrigerant and pumps. So 1 kW of electrical usage can move 3 kW of heat at times:
I think what the post you replied to meant is that when your home needs a 10kW-20kW heater to actually be able to heat your home, then spending tons of money on a heat pump which (for the largest models) can maybe pump out 7kW of heat (equivalent) under optimal conditions (when it's not that cold outside) then you have paid a lot of money and you're still freezing. So you may as well install something else, even a simple wood stove can provide 10kW or more, sometimes much more.
If you need 20kW and install a system that can output 20kW under the worst situation (resistive heating), you are probably averaging about 7kW of electric usage when the heating is on to generate 20kW (about 3:1 ratio on average)
Setting aside capital costs that's going to cost you 7kWh per hour of heating. An oil boiler will cost 20kWh per hour of heating.
If your oil costs 40c per litre/$1.50 per gallon and each litre delivers 10kWh, that's about 80c/hour to heat
If your electricity costs 10c per kWh, that's 70c/hour to heat, that's a win
If your electricity fosts 15c per kWh, that's $1/hour to heat, that's a loss
Absolutely - but the important thing is that you can actually get a 20kW gas boiler, but you can't get a consumer 20kW heat pump. You can buy the most expensive consumer heat pump you can find, and it won't do at all if you actually need 20kW. So you can as well save the money as you'll have to install a gas heater (or oil or wood heater) anyway.
> Absolutely - but the important thing is that you can actually get a 20kW gas boiler, but you can't get a consumer 20kW heat pump.
If even you could, you may not want to. Instead one external heat pump handle heads on the top floor, which is generally bedrooms, and not occupied during the day; a second external unit to handle heads on the main floor, which are generally not occupied overnight.
Each individual smaller unit runs less because the load is more focused in 'zones'.
The other issue is that a heat pump has to keep the output temperature relatively low to stay efficient - so just dropping a heat pump in to replace a wet heating system with a gas boiler will have two problems - the total power is less, and the amount of power the existing radiators can deliver to the room is too low. Effectively heating a house with lower temperature water needs big radiators or wet underfloor heating.
"The Daikin Altherma 3 H HT air source heat pump can provide water with temperatures up to 70°C – the same level as gas boilers – and can work when it’s as cold as -28°C outside."
It can make leaving water temps (LWT) of 70°C. It can work when it's as cold as -28°C outside.
What it can't do is both at the same time: make 70°C LWT when it's -28°C outside. It's designed for 65°C LWT (some models 60°C) and can only reach 70°C at a performance penalty (year-round) and can only maintain 70°C LWT down to -15°C and starts to lose max LWT, heating capacity, and even more efficiency below that. (Losing efficiency a few days out of the year is a minor concern. Not being able to meet the heat loss and heat transfer for the building for a few days is a much more serious issue for health and comfort.)
Heat pumps can't be more efficient than the theoretical Carnot heat engine running in reverse, whose efficiency is T_outside / delta_T. In this case it's (273-28)K/98K = 2.5.
I guess being 2x as efficient (cheap) as electric resistive heating isn't super-terrible, but it's not great either.
Compare this to a favorable groundwater heat pump configuration with good radiators and insulation where the 'outside' (groundwater) is maybe 10°C and the target temp 30°C (close to room temp): (273+10)K/20K = ~14.
That article was generally informative, but they forgot (as far as I could tell after a quick read) to include something very important: How much heat can that Daikin heat pump provide? 3kW? 6kW? 10kW? Can it provide more than a standard air-to-air heat pump which typically can provide less than 7kW under optimal (read: Not that cold outside) conditions? This is important to know before buying one (any type of heat pump)
"from £12,500" I guess it comes in different sizes
To be honest the prices I see out there are still generally 'luxury' anyway. If i am spending £20k on a boiler, then an extra £2k to have a secondary gas system that never/very rarely gets used wouldn't bother me at all.
To understand the difference in a short and simplyfied way:
1. Your examples are heating up the inside air by using energy (burning fuel). Doing so will always be less than 100% efficient, some heating technologies are as little as 10-20% efficient (energy per kWh)
2. Heatpumps are instead using energy to do heat transfer. Moving heat from the outside to the inside.
The latter is way more efficient, with easily 300-400% efficiency. But obviously the colder it gets outside, the less heat is in the air to extract and the efficiency goes down.
Maybe they're referring to cases where the heat pump can't supply heat faster than what the building is losing through the uninsulated walls. In such cases, you must first move out of the holey tent before installing a heat pump.
The $/capacity may be quite different. The capacity of burner systems is generally cheap, so you oversize them and if you need more heat, you just burn more fuel. The capacity of a heat pump is relatively expensive, so you size it up to something reasonable, and in an unusually cold day you may hit the limits of how much joules you can get out of it.
Also, the $/fuel is different - if one system gets three times more joules from the same fuel, it doesn't mean it's more efficient as the other system may be using four times cheaper fuel; so a 300%-efficient heat pump is more efficient than a resistive heater but may be less efficient than a furnace burning cheap fuel.
Heat pumps take much longer to heat the system, to get it to the desired temperature. Combine that with a property that is not insulated to very high standard, and you get a heating system that is incapable of keeping you warm.
Of course, you could throw more money at it. But it won't be cheap, and you won't see a return on your investment any time soon.
Speed / response is a perfectly valid difference. Had not considered it.
Leaky houses are already throwing money at the heating problem, and perhaps with a slower response time you would 'idle' the heating circuit at a passive 25C against 18C room temperature, and throttling up from there. Throwing money at it works!
It's not different but the amount of heat that each system can be generated is different. And when it's cold (i.e. when you need the extra heat to be compensate for your draft home) your heat pump is going to struggle most.
+1 to this. I had a hpwh installed for my radiant system and after paying >7k to get it up and running, I learned that this model is entirely unsuited to that setup and Rheem refuses to accept a return.
If anyone wants a barely used 120 volt hpwh in the bay area, get in touch.
Years ago I visited my home country with my partner. She used to prefer going to dentist there, old habits I guess. On this particular trip I agreed to a check up as well - It had been a while since I had my teeth checked, why not?
Really fancy dentists. Big offices, flashy machines, everything looked pristine. X-rays are taken, teeth are checked. Result: You need root canal! You should have it done soon, it's going to get much worse and hurt a lot more! We can do book you in ASAP.
Hollllld on. I was on holiday, I'm not about to have a root canal procedure done and ruin my time off. I'll take the xrays and check back with a dentist back home.
I pay dearly for the check and xrays and proceed to not enjoy my time off as much as I could have - I was worried.
Fly back home, book a session with my usual dentist. "I can't see anything wrong with this tooth. But let me do an xray as well... Nope. Can't see anything wrong."
It has been around 5 years now. That dentist would have performed root canal on me for no apparent reason...
One really interesting conversation I had with my usual dentist:
Me: So really, nothing wrong? Why would they say otherwise?
Dentist: Nothing wrong. I'm not sure why they told you otherwise.
Me: That's just...
Dentist: Tell you what, they say it's this tooth points, right? Do any other of your teeth look different in the xray? Check the root as well, pay close attention.
Me: I don't see any difference, but I'm not a dentist...
Dentist: Well, I am a dentist, but I also see no difference.
An Anker Power Bank (24,000mAh) has a £40 discount right now on Amazon UK.
This is a really nice piece of tech that has helped me to work outside the house with peace of mind. Can keep my phone charged (which I use for tethering) for over a week, no problem. Drains way quicker when charging my M1, but that one has far less battery issues when compared to my phone.
The discount is real, as well. I know because I bought it recently, but you can also check it against camelcamelcamel or keepa.
Anyone else bothered that they do not specify the energy in watt-hour? Back when USB was 5V it was pretty easy to do the conversion from Ah, how does it work now that USB can negotiate voltage dynamically?
You should be able to calculate the watt hours based on the voltage of the internal batteries. Its likely a 3.7v lithium, so this anker bank would be 3.7v x 24,000mAh = 88.8Wh
The issue is comparable to mileage numbers... I dont trust that at all.
Usually they just multiply the number of cells with their "rated" mAh-value, but who knows what their cutoff voltage is. Also you need to integrate over the voltage (which keeps falling during discharge) and the discharge graph also depends on how much power you draw. Then the 4.2V=>5V (or 9..19V for USB PD) conversion losses are also not counted.
Anker does specify the Wh ratings. Just on the battery itself, not the website. In flyspeck 2.8pt size font (I just checked with my Peak 10x inspection loupe with reticule, the characters are exactly 1mm x-height), dark gray on black for maximum unreadability, that needs a microscope to read. On my 737, it says 86.4 Wh.
I've jump started lots of cars over the past 30 years and was super skeptical of these at first. They are pretty incredible. 3-4 starts off of one charge easily and make for a hell of a battery pack.
Just mind the size because they are quite a bit chunkier than average power packs.
edit: I’ve bought a few of these as gifts. I *strongly* prefer the ones with a molded softshell case to manage the jumpers. I haven’t found any from a well-known brand that weren’t just re-badged noname products with a big mark up. Project Farm on YouTube has some of the best product reviews out there, it looks like he’s done a bit of a bake off, might be worth your while watching if you’re looking at these.
I bought one off of Amazon that stopped working after three months, extraordinarily frustrating. Hard to find a decent brand since they all seem to be cheap junk.
This thread reminded me that I was thinking about picking one up, I just looked again and it’s almost impossible to pick from the offerings that are out there.
Can you give an example of one? It blows my mind that this is possible - I mean not the technology exactly, that makes sense, but just that something reasonably portable that I would carry around in case my phone dies can also have the level of utility of jumping my vehicle in a pinch.
The battery packs for jumping cars (at least the ones I've seen) are generally more of a size appropriate for putting in a trunk than a backpack or pocket.
I had one a while ago when road tripping in the US, served me a few times, it won't fit in your average jeans pocket but it easily fits in a jacket, you could fit 20+ in your glovebox
That does look like a good discount, but in the US it's still pretty pricey ($100). For my needs, the 535 looks like a better deal — it's $50 and has 30W max. Fine for my M2 MBA and certainly my iPhone and other peripherals. It's 20k instead of 24k, but it's half the price and still has USB-C. Not a bad deal!
That's a feature I wish all batteries had. The 737 is twice the weight of my Nitecore NB20000 for not much extra capacity, and I don't have a laptop that draws more then 45W anyway, but I got it for that one feature alone.
I can't imagine a quicker "kthxbye".