I have been programming for over 15 years now. I consider myself a very good programmer, but I understand (like all of us) there are things that I need to work on. One of these things is code repetition when dealing with conditions. I will give a generic sample:
LAV Filters 0.82.0 by Razvan Serea
LAVFSplitter is a multi-format media splitter that uses libavformat (the demuxing library from ffmpeg) to demux all sorts of media files.
LAV Splitter is a Souce Filter/Splitter required to demux the files into their separate elementary streams. LAV Audio and Video Decoder are powerful decoders with a focus on quality and performance, without any compromises. Supported Formats: MKV/WebM, AVI, MP4/MOV, MPEG-TS/PS (including basic EVO support), FLV, OGG, and many more that are supported by ffmpeg!
LAV Filters are based on ffmpeg and libbluray and is aimed to offer a all-around solution to perfect playback of file-based Media as well as Blu-rays.
LAV Filters 0.82.0 changelog:
LAV Splitter
NEW: Support for demuxing Dolby Vision Enhancement Layer streams
NEW: Support for Animated WebP images
Changed: When demuxing Blu-ray discs, Dolby Vision metadata is available on the primary video stream
LAV Video
NEW: Support for Animated WebP images
Changed: Hardware decoding support for DVDs has been removed
Download: LAV Filters 0.82.0 | 15.5 MB (Open Source)
View: LAV Filters Website | Screenshot
Get alerted to all of our Software updates on Twitter at @NeowinSoftware
For some reason when EU forced Microsoft to allow users to change the default browser and search provider in Windows (also no ads for Office and the likes) - it was good. But when it comes to Apple - then it's bad.
BTW, Apple would have gone out of business if Microsoft wasn't pressed by US government several decades ago. 😉
I understand Microsoft's intention here, at least I think I do.
There have been so many printer driver related problems over the years due to OEM printer drivers not be compatible with the latest Windows update, that Microsoft wants to eliminate those by controlling the printer driver updates and keeping them compatible with the latest Windows update.
That is okay as far it goes, but what it can do is put limitations on printers that wouldn't be there with OEM drivers since the OEM printer drivers are not universal drivers.
It's a tradeoff and one can only hope it doesn't turn all Windows printers into $69 Brother printers.
Question
xWhiplash
Hello,
I have been programming for over 15 years now. I consider myself a very good programmer, but I understand (like all of us) there are things that I need to work on. One of these things is code repetition when dealing with conditions. I will give a generic sample:
if(condition1) { //perform some logic if(condition2) { //perform some logic if(condition3) { //Perform logic } else { //MethodA(param) } } else { //MethodA(param) } } else { //MethodA() }Now, I cannot make it easy by doing the following:
if(condition1 && condition2) { } else { }I cannot do this since I need to perform some logic if condition1 is true and before I test condition2.
Is there a way to structure if...else blocks to where if you need to call a method in each else blocks, you are not repeating yourself?
Link to comment
https://www.neowin.net/forum/topic/1226783-avoid-code-repetition-in-conditions/Share on other sites
80 answers to this question
Recommended Posts