News for hackers. Stuff that matters.
Re:Defensive Programming by Geminidog on Wednesday December 23, 2020 @12:49PM (#25520095)
I was a python programmer before I became a c++ developer and believe it or not despite lack of type checking, big python apps have much less bugs then a comparable c++ app due in no part to offensive programming features built into python. In other words you don’t need to offensively program in python, it’s a given.

Firmware is just a pain in the ass to deal with. Wish there was a better way.

Re:Defensive Programming by ben-schaaf on Thursday December 24, 2020 @02:21AM (#25525668)
> believe it or not despite lack of type checking, big python apps have much less bugs then a comparable c++ app

Despite the lack of static typing, python has memory safety and a GIL; eliminating a much larger class of bugs, so it's not that hard to believe.

Re:Defensive Programming by Geminidog on Thursday December 24, 2020 @09:41AM (#25527827)
Additionally clear error messages similar to offensive programming. Any runtime error in python reads like a compile time error with the interpreter giving you the exact location where the error occured and what error occured.

You'd be surprised how many c++ programmers think python is a terrible language just simply due to the lack of type checking and indentations.

A lot of them have no idea how much easier and how much more productive life is outside of the c++ world. Take a look at the other replier. He's thinking "perhaps" it's true, he has no idea.

Re:Defensive Programming by rutthenut on Thursday December 24, 2020 @07:10AM (#25526840)
Firmware requires serious design, code and test regimes to deliver safe, and reliable components.

That same pain-in-the-arse requirement is true of other software, albeit higher-level platforms can perhaps save your arse when bugs are encountered

Re:Defensive Programming by Geminidog on Thursday December 24, 2020 @09:59AM (#25527972)
No. This shows a very narrow regime of experience. Testing is not the only way to verify software additionally the error surface area of certain languages is simply much much smaller in most languages outside of c++.

This had nothing to do with a language saving your arse. This has everything to do with the simple non-existence of a type of bug in other languages, for example memory safety in rust and python.

Additionally c++ often simply does not tell you where an error occurs and you have to use a coredump to figure everything out. It's not an offensive programming strategy by default. Python on the other hand makes every single type of error read like a c++ syntax error giving you a line number and an error type by default.

Another thing to consider is raw speed and lower memory requirements. These are the only advantages of c++. If your hardware isn't strict on the above requirements consider micropython.

I'm finding c++ programmers have this very narrow and cocky view of the world. They turn their nose up at languages like python without truly experiencing how much life is easier and more productive in those worlds.

Re:Defensive Programming by rutthenut on Monday January 04, 2021 @12:30PM (#25634759)
Far from narrow experience, C/C++ is just one of the languages I have used to deliver systems over a long period of time.

Not being cocky and not turning my nose up at Python as I know it can be productive and allow quick creation of solutions.

But pointing out that my experience has also encompassed high-resilience, high-availability, low-latency, fault-tolerance, high-security, air-gapped and embedded systems along the way. For the latter of those especially, the rigour of defining requirements and proving them during design and test phases, are key facets that go beyond the choice of any programming language whether modern or old.