Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Monday, 3 February 2014

Testing on Android : Unit Tests

JUnit Tests

There's no reason you can't use normal JUnit 4 testing for Android applications... as long as you stay away from anything Android.

Normally you compile against the SDK's android.jar, which contains nothing but stubbed methods that throw exceptions when run.  When you actually upload your APK to a device, it uses the device's implementations of all those stubs.  As a result, when running normal unit tests in your IDE, you get no access to those framework implementations (instead receiving mountains of exceptions).  This is not a big deal if you're testing some simple functionality that doesn't touch Android itself.

Pros:

            Fast and easy
Cons:
            Cannot use any Android framework classes



The Android Testing Framework

The Android testing framework is the official method of unit testing on Android.  It loads your application onto a device, then runs JUnit-based test suites.  Since it runs on the actual OS you can use the Android framework as you normally would in your application and can conduct a series of realistic tests that way.

Ostensibly the testing framework is unit testing, but the slowness of having to fully compile and upload your app onto a device before executing any tests makes testing slow.  Plus, you have to make sure you've got a device attached or an emulator running.  As a result, I might consider the testing framework for semi-regular tests (e.g., whenever you push a new commit, or nightly tests) but I would have trouble using them while actively developing.

Pros:

            Access to the Android framework
Cons:
            Slow
            Requires attached device or running emulator
            Uses JUnit 3 (instead of the newer JUnit 4)



Robolectric

Robolectric is a project that unifies the speed of unit testing with the ability to access the Android framework.  It does this by implementing all those stubs with mocked classes.

Having tried it out, it is lightning fast and works as expected.  I'm also impressed with the amount of active development on it - this is a rapidly improving framework.  However, the active development does take a toll; documentation is a bit lacking, plus some new versions of Robolectric break things in previous versions.  Plus, it can't mock everything - for example, inter-app communication - since it's not on an actual Android OS.  That said, the benefits here far outweigh the negatives when it comes to unit testing Android.

Pros:

            Fast
            Can access mocked Android framework
            Actively developed
Cons:
            Not the true Android framework
            Not everything is mocked
            Lacking documentation

Rultech Blog - Wordpress
Rultech Blog - Blogspot
Rultech Knowledge Base - Knowledge Base



Pro!deaClub - Blogspot 

Sunday, 19 January 2014

Way to create good User Interface Design

  Clarity is job #1

Clarity is the first and most important job of any interface. To be effective using an interface you've designed, people must be able to recognize what it is, care about why they would use it, understand what the interface is helping them interact with, predict what will happen when they use it, and then successfully interact with it. While there is room for mystery and delayed gratification in interfaces, there is no room for confusion. Clarity inspires confidence and leads to further use. One hundred clear screens is preferable to a single cluttered one.

  Interfaces exist to enable interaction

Interfaces exist to enable interaction between humans and our world. They can help clarify, illuminate, enable, show relationships, bring us together, pull us apart, manage our expectations, and give us access to services. The act of designing interfaces is not Art. Interfaces are not monuments unto themselves. Interfaces do a job and their effectiveness can be measured. They are not just utilitarian, however. The best interfaces can inspire, evoke, mystify, and intensify our relationship with the world.

  Conserve attention at all costs

We live in a world of interruption. It's hard to read in peace anymore without something trying to distract us and direct our attention elsewhere. Attention is precious. Don't litter the side of your applications with distractible material…remember why the screen exists in the first place. If someone is reading let them finish reading before showing that advertisement (if you must). Honor attention and not only will your readers be happier, your results will be better. When use is the primary goal, attention becomes the prerequisite. Conserve it at all costs.

  Keep users in control

Humans are most comfortable when they feel in control of themselves and their environment. Thoughtless software takes away that comfort by forcing people into unplanned interactions, confusing pathways, and surprising outcomes. Keep users in control by regularly surfacing system status, by describing causation (if you do this that will happen) and by giving insight into what to expect at every turn. Don't worry about stating the obvious…the obvious almost never is.

  Direct manipulation is best

The best interface is none at all, when we are able to directly manipulate the physical objects in our world. Since this is not always possible, and objects are increasingly informational, we create interfaces to help us interact with them. It is easy to add more layers than necessary to an interface, creating overly-wrought buttons, chrome, graphics, options, preferences, windows, attachments, and other cruft so that we end up manipulating UI elements instead of what's important. Instead, strive for that original goal of direct manipulation…design an interface with as little a footprint as possible, recognizing as much as possible natural human gestures. Ideally, the interface is so slight that the user has a feeling of direct manipulation with the object of their focus.

  One primary action per screen

Every screen we design should support a single action of real value to the person using it. This makes it easier to learn, easier to use, and easier to add to or build on when necessary. Screens that support two or more primary actions become confusing quickly. Like a written article should have a single, strong thesis, every screen we design should support a single, strong action that is its raison d'etre.

  Keep secondary actions secondary

Screens with a single primary action can have multiple secondary actions but they need to be kept secondary! The reason why your article exists isn't so that people can share it on Twitter…it exists for people to read and understand it. Keep secondary actions secondary by making them lighter weight visually or shown after the primary action has been achieved.

  Provide a natural next step

Very few interactions are meant to be the last, so thoughtfully design a next step for each interaction a person has with your interface. Anticipate what the next interaction should be and design to support it. Just as we like in human conversation, provide an opening for further interaction. Don't leave a person hanging because they've done what you want them to do…give them a natural next step that helps them further achieve their goals.

  Appearance follows behavior

Humans are most comfortable with things that behave the way we expect. Other people, animals, objects, software. When someone or something behaves consistently with our expectations we feel like we have a good relationship with it. To that end designed elements should look like how they behave. Form follows function. In practice this means that someone should be able to predict how an interface element will behave merely by looking at it. If it looks like a button it shouldact like a button. Don't get cute with the basics of interaction…keep your creativity for higher order concerns.

  Consistency matters

Following on the previous principle, screen elements should not appear consistent with each other unless they behave consistently with each other. Elements that behave the same should look the same. But it is just as important for unlike elements to appear unlike (be inconsistent) as it is for like elements to appear consistent. In an effort to be consistent novice designers often obscure important differences by using the same visual treatment (often to re-use code) when different visual treatment is appropriate.

  Strong visual hierarchies work best

A strong visual hierarchy is achieved when there is a clear viewing order to the visual elements on a screen. That is, when users view the same items in the same order every time. Weak visual hierarchies give little clue about where to rest one's gaze and end up feeling cluttered and confusing. In environments of great change it is hard to maintain a strong visual hierarchy because visual weight is relative: when everything is bold, nothing is bold. Should a single visually heavy element be added to a screen, the designer may need to reset the visual weight of all elements to once again achieve a strong hierarchy. Most people don't notice visual hierarchy but it is one of the easiest ways to strengthen (or weaken) a design.

  Smart organization reduces cognitive load

As John Maeda says in his book Simplicity, smart organization of screen elements can make the many appear as the few. This helps people understand your interface easier and more quickly, as you've illustrated the inherent relationships of content in your design. Group together like elements, show natural relationships by placement and orientation. By smartly organizing your content you make it less of a cognitive load on the user…who doesn't have to think about how elements are related because you've done it for them. Don't force the user to figure things out…show them by designing those relationships into your screens.

  Highlight, don't determine, with color

The color of physical things changes as light changes. In the full light of day we see a very different tree than one outlined against a sunset. As in the physical world, where color is a many-shaded thing, color should not determine much in an interface. It can help, be used for highlighting, be used to guide attention, but should not be the only differentiator of things. For long-reading or extended screen hours, use light or muted background colors, saving brighter hues for your accent colors. Of course there is a time for vibrant background colors as well, just be sure that it is appropriate for your audience.

  Progressive disclosure

Show only what is necessary on each screen. If people are making a choice, show enough information to allow them the choice, then dive into details on a subsequent screen. Avoid the tendency to over-explain or show everything all at once. When possible, defer decisions to subsequent screens by progressively disclosing information as necessary. This will keep your interactions more clear.

  Help people inline

In ideal interfaces, help is not necessary because the interface is learnable and usable. The step below this, reality, is one in which help is inline and contextual, available only when and where it is needed, hidden from view at all other times. Asking people to go to help and find an answer to their question puts the onus on them to know what they need. Instead build in help where it is needed…just make sure that it is out of the way of people who already know how to use your interface.

  A crucial moment: the zero state

The first time experience with an interface is crucial, yet often overlooked by designers. In order to best help our users get up to speed with our designs, it is best to design for the zero state, the state in which nothing has yet occurred. This state shouldn't be a blank canvas…it should provide direction and guidance for getting up to speed. Much of the friction of interaction is in that initial context…once people understand the rules they have a much higher likelihood of success.

  Great design is invisible

A curious property of great design is that it usually goes unnoticed by the people who use it. One reason for this is that if the design is successful the user can focus on their own goals and not the interface…when they complete their goal they are satisfied and do not need to reflect on the situation. As a designer this can be tough…as we receive less adulation when our designs are good. But great designers are content with a well-used design…and know that happy users are often silent.

  Build on other design disciplines

Visual and graphic design, typography, copywriting, information architecture and visualization…all of these disciplines are part of interface design. They can be touched upon or specialized in. Do not get into turf wars or look down on other disciplines: grab from them the aspects that help you do your work and push on. Pull in insights from seemingly unrelated disciplines as well…what can we learn from publishing, writing code, bookbinding, skateboarding, firefighting, karate?

  Interfaces exist to be used

As in most design disciplines, interface design is successful when people are using what you've designed. Like a beautiful chair that is uncomfortable to sit in, design has failed when people choose not to use it. Therefore, interface design can be as much about creating an environment for use as it is creating an artifact worth using. It is not enough for an interface to satisfy the ego of its designer: it must be used!
Rultech Blog - wordpress
Rultech Blog - blogspot

Monday, 30 December 2013

Rultech Weekly

iOS News

Is your AppDelegate.m cluttered with a lot of initialization code? There is a better way to organize all that code with launchOptions parameter. Great article from Mattt on different launchOption keys and code snippets on how to use it.

We all have spent numerous hours going back and forth arranging pixels and waiting for the app to build and look for the output on simulator. Ole has worked out a way with the help of Classy, Masonry and ClassyLiveLayout to see live edits in the simulator.

Great overview of Core Bluetooth APIs and best practices. iOS 7 made some great additions to the Core Bluetooth API and with iBeacon using Bluetooth LE under the hood, Apple is surely going to make more additions to it in the future versions.

UI Dynamics is the newly added library to iOS 7 that allow you to add real-world inspired interactions to your UI. Mehfuz Hossein step-by-step shows how to create a simple slide-out menu with UI Dynamics. Definitely check it out if you havent yet used UI Dynamics in your app.

Goes without saying, debugging is the most time consuming thing we do as a programmer. XCPretty library helps you format Xcode build log so you can clearly look at the error messages rather than reading between the lines.

Design

Logo matters, it gives the first visual identity to your app. Its worth looking into logo creation from every perspective. Take a look at 11 of those perspectives in this great visual post.

Dragging things from one side of the screen to another is painful and even more so when its on a touch screen. Dave makes a good case for using touchable interface rather than drag & drop.

Business and Marketing

Software Developer Dennis Reimann lists his reasons for switching to a freemium model for your apps. Interesting read which discusses the growing Freemium model and the App stores tendency to leave "demo" version of apps behind in search rankings.

When words can only go so far, its up to you to screenshot the essence of your app for the respective store. Use this guide to make sure the pictures of your app are at their best.


Android News

Ever given thought to what the programming of tomorrow will look like? An Android developer walks us through a sample of what its like to develop for Google Glass.

Want to allow users to limit your app access to certain profiles? Gabriele has written a great post on how to accomplish it. Netflix just started doing it, you should too!

If you are like me you probably hate writing tests. But its good to know your options just in case. Wiebe walks through four different functional testing frameworks in this post.

Design

When words just wont do the trick you can use this collection of icons for relaying hand motions for user navigation. Fast, functional, and free.


Cross-Platform development is sometimes considered the way to go but developing the app and designing it can be worlds apart. This post aims to eek developers into consideration regarding the vastly different UIs of the standard iOS and Android App.


Rultech Blog - wordpress
Rultech Blog - blogspot
Rultech Knowledge Base
Pro!deaClub Blog
Pro!deaClub - blogspot

Friday, 17 August 2012

Anti-Insects

The App name itself describes the application, But still i will give you a brief idea about it.
There are about 3500 known mosquito species in the world and they all react slightly different to the repeller. Use the pitch selector to find optimal repelling frequency for the mosquitos in your region.
As the Animals and Insects can hear the high frequency noise,
we have use 3 different high frequency to keep away insects, mainly mosquitoes and other insects