C++ or Java for commercial software?

  Рет қаралды 1,568

The Deliberate Engineer

The Deliberate Engineer

Күн бұрын

In my 30 years at Microsoft, Amazon, and Google, priorities for code changed dramatically. Speed of development and ease of maintenance became far more important than resource efficiency.
This video talks about the pro's and con's of garbage collected [GC] (e.g. Java) and non-garbage collected (e.g. C++) languages, and explains why these days most commercial software is best written in a garbage collected language like Java or C#!
TABLE OF CONTENTS
00:00 Introduction
00:55 Explicit resource control in practice
02:21 Explicit resource code snippet
03:29 Garbage collected code snippet
04:02 What garbage collection does
04:52 Benefits of coding in a GC language
05:21 The downsides of GC
07:20 Why GC downside isn't in explicit code
08:43 Changes in the world making GC less problematic
09:55 Summary

Пікірлер: 22
@scoberry
@scoberry Жыл бұрын
Hey, John. Sorry, random bug spot: at 3:14 or so, there's an extra return on line 15 that means the function can't ever execute successfully. (It's a good example of how the volume of error-handling code can allow bugs to creep in. ;-) ) I hope everything's going okay with you.
@TheDeliberateEngineer
@TheDeliberateEngineer Жыл бұрын
Nooooooo well I am too lazy to go back and fix it, but thanks for finding it! Life is good, hope the same is true for you!
@scoberry
@scoberry Жыл бұрын
@@TheDeliberateEngineer Good. Yeah, things are going well. The commute's long, though. I'll have to do something about that eventually -- probably give it a few years after the house is paid off (that part's soon), then think about where we want to live.
@teacherinthailan6441
@teacherinthailan6441 2 жыл бұрын
Thank you so much for sharing your wisdom. It's very much appreciated.
@TheDeliberateEngineer
@TheDeliberateEngineer 2 жыл бұрын
Thank you for letting me know it's useful, and for watching!
@Antox68
@Antox68 10 ай бұрын
From my experience C++ isn't much harder to write than java if you do it right. In most cases you don't need to use pointers. You can just instantiate objects on the stack and use move() and references when needed. In case you do need to use pointers, you can always use smart pointers.
@DiogoBaeder
@DiogoBaeder Жыл бұрын
Rust brings the best of both worlds: the avoidance of garbage collection, but without needing explicit de-allocations, just by controlling ownership of variables and dropping (de-allocating) them automatically when not used anymore.
@mohabkhaled1391
@mohabkhaled1391 2 жыл бұрын
Thank you john, this is an important one and as usual the long-hands on experience reflected on this controversial subject in a way that begins with the real world while noticing how things move in history (i think mentioning moving from a position where resources were limited to the current state where there are resource-rich environments is an important insight), this is the first time i know you also reached to work with OSs, if anything to suggest here is shedding light on the terms appeared in the video (perhaps in an exclusive way without going in-depth - memory management, resource allocation, garbage collectors ..etc.), this is because there are people capitalize on deliberately obscuring these things, i get confused whenever there is a discussion about why we should switch from X-lang because of memory management, or how X compiles, or type safety (and i know some of these topics are crucial, and some of - like what we saw on this episode- have a specific context), at least what you think make important research topics for building commercial-grade software (from a programming language/operating system point of view) . As usual thank you john for the great insights, and have a nice day !
@TheDeliberateEngineer
@TheDeliberateEngineer 2 жыл бұрын
Thanks for the comments and suggestions! I never know quite where to draw the line with terminology. I used to explain everything, but then half of the time anyone spent listening to me was things they already knew. Is there any particular term or sub-topic that you think is worth spelling out a bit (say in a pinned comment) or having a separate video on?
@mohabkhaled1391
@mohabkhaled1391 2 жыл бұрын
@@TheDeliberateEngineer thanks for the response john!, it' the other way around, the thing is that we (beginners moving to mid) got surprised with new topics that is a step deeper than the usual development (say memory management or multi threading), it's important to list these topics so we can dive deeper into them, the case that i want to avoid is being surprised or confused with a new term that i have zero knowledge about, knowing what are these lower-level topics that you consider important for programmers would help even if you don't specifically explain them in depth, the case that i want to achieve is when i hear them at least i would remember that "Oh! this something john mentioned that i probably had to dig deeper" instead of being totally blanked.
@ZachStein
@ZachStein 2 жыл бұрын
I think the comparison is fair, I think I typically reach for garbage-collected languages first because of the productivity. I think you hit the nail on the head about productivity, testability, and how modern hardware is less resource-constrained. I think like most things in our world the answer is "It depends" which isn't really the most satisfying thing to most people these days because that implies there's nuance and people want "Yes or No". I tend to reach for something else when latency is critical and resources are more constrained. Although these days with where my career is currently, it tends to be exclusively garbage collected. One other interesting thing that could be covered is some languages, I know specifically Java for example allow you to call out to external native libraries (Foreign functions) written in other languages. I've written Java applications before that use JNI for near-hardware type things (One example that comes to mind is an application I worked on that used JOGL for rendering), so you can get some of the best of both worlds.
@mohabkhaled1391
@mohabkhaled1391 2 жыл бұрын
thank you Zach for the insight, mentioning working with computer vision, there is a software (Unity Unreal Engine) that is written in C# which is not the fastest language so to speak, now this specific software is really a good one and renders very detailed views without any noticeable delays or glitches (in fact without anything at all, it's one of the best), now if that is the case, and knowing computer vision consumes lots of resources, and extending some points made in the video, could we say that C++ place in computer vision is coming from an era when constraints were tight, and debating about how fast it is against others from an industry point loses some of it's solidarity?
@TheDeliberateEngineer
@TheDeliberateEngineer 2 жыл бұрын
Thanks for the detailed thoughts! I'm with you, the answer is almost always "it depends, what do you care about?"
@mattwilliams6500
@mattwilliams6500 2 жыл бұрын
I will say as a C++ embedded dev that modern post-2011 versions of C++ completely stopped the need for new and delete for that reason you listed, even in a resource constrained environment the modern features of smart pointers and Rule of 5/RAII seem to solve that. Really there are issues with modern C++ but a lot of that has to do with backwards compatibility or confusing newer features. The biggest weakness is the build system/package management. Java is fast enough in most cases and was better for backend stuff especially compared to pre-11 C++, but now I find Java does not have the web advantage. It's easier to do most web stuff in JavaScript and mix that with whatever your team needs/is comfortable with in my experience. 👍
@TheDeliberateEngineer
@TheDeliberateEngineer 2 жыл бұрын
C++ 11 was the last C++ I used, and it definitely made a lot of the memory management easier for most cases, as you say! I haven't used Javascript yet, it's always been on the "I should do that sometime" but typically I'm a layer deeper in the stack. But, someday!
@groovy-kb8km
@groovy-kb8km 2 жыл бұрын
What do you think about Cython as alternative of Python? As far as I know, cython is as fast as C++ and easy to be compiled from pure python code. So I think Cython has two advandates: Easy implementation and Fast running time. What do you think? (I am just junior developer so my explanation should be not correct)
@CSm.a
@CSm.a 2 жыл бұрын
Cython's speed is 2x-3x of interpreted python yet no near java neither c++. Also try pypy it also fast and way easier to use relatively cython.
@TheDeliberateEngineer
@TheDeliberateEngineer 2 жыл бұрын
Unfortunately I'm not familiar with python or its variants, so we'll have to hope someone else chimes in!
@groovy-kb8km
@groovy-kb8km 2 жыл бұрын
@@CSm.a thanks! should we modify pure-python code into pypy-style if we want to use pypy?
@CSm.a
@CSm.a 2 жыл бұрын
@@groovy-kb8km not really you can just install pypy compiler and use it
@Sanyu-Tumusiime
@Sanyu-Tumusiime Жыл бұрын
i prefer C++. here's why. harder language --> more talented people. aka. your peers are going to be smarter and you'll benefit from that. better performance --> why bother sacrificing performance when you don't need to. just work around it and get better. control --> you're better off just writing longer code. it doesn't matter if it's harder, just learn it and get over it. if not, you'll have your smarter peers to help you out. just my 2 cents. don't bother with gabage collected language. you're better off just sticking with something faster and something with smarter people writing it.
@TheDeliberateEngineer
@TheDeliberateEngineer Жыл бұрын
I can't fault you for preferring C++, and I'm with you on the 'better performance' for carefully written code. I don't think the other two are universal, though. I know some brilliant people who write in garbage collected languages. At most of the places I've worked, performance is far less important than correctness and maintainability.
Starting "Impossible" Software Engineering Tasks - tips from a principal engineer
14:47
Beating Random with Heuristics is HARD!
9:23
The Deliberate Engineer
Рет қаралды 852
Do you have a friend like this? 🤣#shorts
00:12
dednahype
Рет қаралды 56 МЛН
Cat story: from hate to love! 😻 #cat #cute #kitten
00:40
Stocat
Рет қаралды 16 МЛН
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Рет қаралды 311 М.
Should you be an AAA game developer?
14:16
The Deliberate Engineer
Рет қаралды 1,5 М.
About Software Patents from a Principal Engineer
17:50
The Deliberate Engineer
Рет қаралды 3,2 М.
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 214 М.
The Myth of Easy Code Re-use: be skeptical
10:39
The Deliberate Engineer
Рет қаралды 1,7 М.
Software Engineering Process - tips from a principal engineer
16:26
The Deliberate Engineer
Рет қаралды 2,5 М.
Rust Functions Are Weird (But Be Glad)
19:52
Logan Smith
Рет қаралды 125 М.
Be explicit to prevent disappointment in your next job!
8:56
The Deliberate Engineer
Рет қаралды 2 М.
microsoft's new AI feature is an absolute dumpster fire
9:34
Low Level Learning
Рет қаралды 55 М.
1st Q&A with @TheDeliberateEngineer , a principal engineer and manager.
1:05:21
The Deliberate Engineer
Рет қаралды 2,7 М.
#miniphone
0:16
Miniphone
Рет қаралды 918 М.
What model of phone do you have?
0:16
Hassyl Joon
Рет қаралды 77 М.
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 21 МЛН
Теперь это его телефон
0:21
Хорошие Новости
Рет қаралды 2 МЛН
iPhone 15 Unboxing Paper diy
0:57
Cute Fay
Рет қаралды 1,7 МЛН