Platform Dependent Python Coverage Test with Tox

When testing Python programs, is often used in measuring code coverage, and enforcing 100% code coverage is regarded as a good practice:

# .coveragerc
# Enforce 100% coverage test
fail_under = 100
show_missing = True

However, if there are some lines of code that are platform dependent (i.e., they are never executed on at least one platform), code coverage tests usually fail. For example, the following code snippet would always lead to a coverage that is less than 100% on a platform other than Windows:

if != 'nt':
    # Do something if the OS is not Windows...

You can ask to ignore this block by adding a comment # pragma: no cover, but then would ignore it on all platforms, including all non-Windows platforms. If you use tox for testing, this issue can be resolved cleanly.

Continue reading

5 Misconceptions Web Developers Believe About Mobile App Development

Mobile apps have emerged as a competitive alternative to websites. Although websites are still irreplaceable parts of digital presence for business brands, mobile apps have been forcing them to change. The emergence of Progressive Web Apps (PWA) showcases this shift.

In spite of this overwhelming popularity of mobile apps, many web developers still hesitate to improve their skills and extend their focus on mobile app development. What misconceptions the web developers mostly harbor regarding app development? Well, this is what we are going to explain here.

Continue reading

Catching FileNotFoundError? Watch Out!

In Python, FileNotFoundError is an exception that is raised when a requested file does not exist. Many people assume that when their programs fail to open a file in read-only mode or delete a file, FileNotFoundError must be raised and they should only need to process that. For example, some people would write code similar to:

def process_file(path):
    import sys

        f = open(path, 'r')  # or os.remove(path)
    except FileNotFoundError as e:
        print(f"File {path} not found!", file=sys.stderr)
    # process the file...

However, this code may actually trigger unexpected errors. The reason is that, the failure to open a file in read-only mode or delete a file is not necessarily caused by the non-existence of the file. Very often, it's for different reasons: insufficient permission, or the file is a directory. In this case, PermissionError or IsADirectoryError would be thrown instead of FileNotFoundError. So, in the example above, one would want to catch all of them:

Continue reading

What Is Mobile App Architecture? — Key Considerations to Build Great App Architecture

For any business, while building a mobile app it is the priority to create apps for reaching their target audience with ease and optimize the app for this specific audience. But among the millions of apps that populate the Play Store and iOS App Store, perhaps only a few thousand can claim to be perfect in terms of user experience and unique value proposition: Many of the vast majority of apps that just fill up app marketplaces without contributing any substantial value is made up of less reliable architecture. Hence we are here to explain what mobile app architecture does, different types of app architecture and the ways to build them.

Continue reading

Learning Casting in Java

Last updated on August 25, 2020

One of the most renowned programming languages at present is Java. Furthermore, Java application development continues to be a lucrative source of income for many people who are into the tech industry. The language is used to create web platforms and web apps, designed for flexibility, which enables developers to write code that runs on any machine, whatever the platform or architecture may be. Billions of computers and mobile phones throughout the world run Java.

What is Java Casting?

Casting, a process of creating a variable as a variable to another type. Software and app developers are aware of the rapid pace of industry requirements. Nonetheless, some instruments continue to remain significant even in times of regularly fluctuating trends. Undoubtedly, Java is the best choice nowadays for software programmers and developers for many reasons.
With Java casting, if a class shares an IS-A or an inheritance relationship with another interface or class, the variables could be cast to the type of each other. There are times that the cast is permitted and at times not allowed. This is because some of the cast won’t show any error at compilation time but would fail during runtime.

Continue reading