Showing posts with label better. Show all posts
Showing posts with label better. Show all posts

Friday, 18 January 2019

C++: The Dilemma of using Exceptions

As a C++ developer I've recently been in the midst of the Exceptions debate.  Exceptions as a feature of the C++ language have long divided the community, naively I've often put this down to their coming to the language from elsewhere (C perhaps) where exceptions were not the norm.

This was a mistake, for in the projects I've previously worked upon the overhead of an exception compared to the ramifications of the error resulting in a crash have often totally outweighed the overhead, making deciding to employ an exception exceptionally easy (*bum bum*).  Exceptions were the norm, still are and should be to you too (according to the C++ Core Guidelines https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-except).

The difficulty, the dilemma if you will, comes not from the feature, but the cost.  If you application domain demands high performance you can not risk using exceptions, the argument carries on therefore whether in not using them to avoid that overhead in performance you are actually cutting off your nose to spite your face... What are the downstream costs if an unexpected, in tested for, error occurs and some strange behavior ensues, or worse it propagates up and out of your application to crash?!!

In the modern era of social media such feedback is near instantaneous, can you afford the egg on face?

And so you spin yourself around and dig further into the ground your problems.

Voices from industry do little to alleviate the problem, google for instance (https://google.github.io/styleguide/cppguide.html#Exceptions), almost seem to advocate using exceptions if from the ground up you can build them in.  You stand the cost of retraining developers and change your ways of working around (e.g. embrace RAII).

They even go so far as to state "the benefits of exceptions outweigh the costs", but then add the caveat "in new projects".  How old or new your project should not define your error handling mechanisms, surely?  Plus from experience I've always found a code base is as old or new as the minds working upon it.  If you have an engineer firmly rooted in C without exceptions they will continue to churn code in that style through your compiler (which will happily work with it), not because it's a better way of working nor because it's a worse way of working, quite often it's continued along simply under the inertia of experience that developer has and they've not time to stop to take stock.

Even given that time, which the project I've just begun working upon has, there's weight behind the past, the old way of working, what worked before, and if that was non-exception handling code people stick with it.  Tell those self same people "you really should use these, oh and you have to retrain your minds, plus it'll take longer to compile and more time to run" they're going to stare at you like you're mental.


The question I'm left with is therefore not whether to use exceptions or not (well I am left with this problem, and this post is no help) instead we're left with the question of when will the benefits of exceptions, their ease of use, simplicity to write and visualise out weight the retraining, compile time and runtime costs?... I don't think that's anytime soon, it should be after so many years, but it's simply not.

x

Tuesday, 21 June 2016

Project - Socket 775 to Socket 771 Xeon - Update

As an update to my original post, I got another socket 775 motherboard and took a video of how to cut the tabs off the socket, making it able to accept a socket 771 Xeon, but doing so with the original chip in place, to protect the socket pins.

Check it out here:



Wednesday, 16 December 2015

WarThunder - BF109-E3 & BF109G6 Matches & Teams

My strategy in both aircraft has basically been the same, climb for altitude off to one side, then fly at a shallow climb into the combat area, at the BR3.7 and below range I find everyone doing the same thing, we get wins, we get kills... So fun has that been, and so successful I've unlocked both the skins for the E3...


So, I jumped up to my next unaced 109, which is the G6.  Here's my progress on the modules:


And things are not getting any better, it's agonisingly slow to unlock anything, because either I'm shooting and hitting Russian aircraft and they put out their fires (scouts honour, I've hit La-5, Yak3 and Yak9's, had them burning as well as any other target - which would go down - only to have them put their fire out, and worse still they loose no fighting ability).

Now, I refuse to believe these players are excellent, in fact in the last game they were good to average opponents, but my team going into them was abysmal, first off, the German team, aside from myself off to one side and two chaps in the middle failed to climb, so straight off we're playing 9v9 and two thirds of our planes are at lower altitude... Next, they enter turning low level fights with lend-lease P39's, Yak9's and Yak3's.

At altitude, I'm coming into the combat zone at 5,500 altitude, 300km/h and looking for a target to dive on, by the time I'm there though there's only two other members of my team left and I have to dive into and through the whole enemy team.

760km/h screaming down on a Yak3, he's going a good 550km/h, my controls are stiff, but I'm waiting for him to try to duck under my guns... There, he ducks, I swerve... My shells totally miss, because of course even now going 600+ the guy looses no control, he can pull a tight barrel roll and rudder control it... I'd be in g-lock "Lost Control" doing that, but not he, for he has ghost of Comrade Stalin blowing into his belly button to keep him upright.

I pull up and away, not wanting to turn, 760/780km/h indicated, I pull up... from 30m alt.... 1600... I'm already down to 300km/h speed... I look behind....


Yes, that's the whole entire enemy team on my six now, and you see that La-7, he's closing that gap with me... But he was closing that gap even when I was going 700km/h.

I'm dead, and this is the annoying thing, I didn't do anything wrong... Diving into the fray at all was my mistake, I should have stayed at 5.5K, climbing to flyaway and live to fight another day.

Whenever I fly against Russian aircraft the same can only be said, I don't get kills, and I get killed.

I don't know, after a month of solid flying the American and German lines, maybe I need to take a leaf out of Tsung Tsu's book and get to know my enemy?  The problem being I don't have much advancement in the Russian aircraft line, since I dislike them, nearly all my vehicle progress in the Soviet tree has been tanks.

The overwhelming conclusion I have though, is that many players at the higher BR rating have either not learned how to energy fight, or don't realise they need to energy fight Russian planes, so I find myself alone and out numbered nearly all the time.

I've been trying to check this on different servers, EU, US, SA, RU... All the servers, it's not the players, it seems to be the match up, at the higher BR playing Germans in Realistic battle I get bad teams.

And this isn't to say I'm the best team member to get, but at least I try and climb, I try and get energy, and then I try to find targets, but then those targets are already in turning fights at sub 1000meters, it's a hell of a waste to have gotten to 5000+ meters, and even more of  a waste to dawdle all the way down to try and attack, they already know I'm there, and they're far more manoeuvrable to dodge out the way.

Successes are few and far between in the G6 and above, in the E3 they're plentiful and fun... The difference?... BR and the teams at those BR's.