Some useful GIT commands

Git is a version control system that is used for software development and other version control tasks developed by Linus Torvalds in 2005. As a distributed revision control system it is aimed at speed, data integrity, support for distributed and non-linear workflows.

git config

Sets configuration values for your user name, email, gpg key, preferred diff algorithm, file formats and more.

git branch -a

Lists existing branches, including remote branches.

git branch -d [branch-name]

Deletes the specified branch

git push origin –delete [branch-name]

Deletes the specified branch from remote

git stash

Temporarily stores all modified tracked files

git stash list

Lists all stashed changesets

git stash pop

Restores the most recently stashed files

git stash drop

Discards the most recently stashed changeset

git reset [commit]

Undoes all commits afer [commit], preserving changes locally

git reset –hard [commit]

Discards all history and changes back to the specified commit

git show

Shows information about a git object.

git grep

Lets you search through your trees of content for words and phrases. Example: git grep “www.google.com” – *.js


Model View Presenter (MVP) on Android

The MVP pattern allows separate the presentation layer from the logic, so that everything about how the interface works is separated from how we represent it on screen. Ideally the MVP pattern would achieve that same logic might have completely different and interchangeable views. First thing to clarify is that MVP is not an architectural pattern, it’s only responsible for the presentation layer . In any case it is always better to use it for your architecture that not using it at all.

Check this simplified MVP example for Android

Model: This is the well known model, present in many of the most common patterns and use cases. It represents the world we are working with, every real world element that our app should know how to represent. Both the View and the Presenter are aware of this model and they know how to use its properties and methods (the view doesn’t really need to know the model and originally shouldn’t but it’s a tradeoff that avoids the need to have setter methods for every field that we want to update).

View: As stated before, views are our Fragment and Activity classes that we are using, they are able to alter the UI as we need and they need to receive structured data from a source in order to populate themselves. This layer shouldn’t know anything else about the obtention of the data, we made it as simple as we could.

Presenter: This layer, introduced here, is implemented with native java code meaning it doesn’t need to know whether it’s used in an Android application or a web service. How does this work with our structure previously described? Easy, what we are going to add to each view is a simple interface which defines the actions that any view using a specific presenter would need to do in order to populate itself with the data it provides. The presenter is responsible to act as the middle man between view and model. It retrieves data from the model and returns it formatted to the view. But unlike the typical MVC, it also decides what happens when you interact with the view.

References

  • https://medium.com/mobiwise-blog/android-basic-project-architecture-for-mvp-72f4b33252d0#.gebnmc1rq
  • http://antonioleiva.com/mvp-android
  • http://hannesdorfmann.com/mosby/mvp/