You are on page 1of 5

NATIONAL DIPLOMA IN SOFTWARE ENGINEERING (NDSE)

STUDENT ID : T1939694G

NAME : MASIMBAASHE J MUKERE

MODULE : EAD 2

ASSINGNMENT 2
Part A

1. What's the difference between onCreate() and onStart()? [4]


onCreate()
Called when the activity is first created. This is where you should do all of your normal
static set up: create views, bind data to lists, etc. This method also provides you with a
Bundle containing the activity's previously frozen state, if there was one. Always
followed by onStart().
onStart()
Called when the activity is becoming visible to the user. Followed by onResume() if the
activity comes to the foreground, or onStop() if it becomes hidden.

2. Name the list of methods which you need to override, in Content Provider class, to
have your Content Provider working. [6]

i. onCreate() This method is called when the provider is started.


ii. query() This method receives a request from a client. The result is returned as a
Cursor object.
iii. insert() This method inserts a new record into the content provider.
iv. delete() This method deletes an existing record from the content provider.
v. update() This method updates an existing record from the content provider.
vi. getType() This method returns the MIME type of the data at the given URI.

3. Explain how Implicit intents differ from Explicit intents. [8]


Implicit Intent doesn’t specify the component. In such a case, intent provides information
on available components provided by the system that is to be invoked while Explicit
Intent specifies the component. In such a case, intent provides the external class to be
invoked. Implicit Intent specifies the only action to be performed and does not directly
specify Android Components while Explicit Intent can do the specific application action
which is set by the code like changing activity and downloading the file in the
background.
Implicit Intend
Intent intent=new Intent(Intent.ACTION_VIEW);

intent.setData(Uri.parse(“https://www.tcfl.co.zw”));

startActivity(intent);

Explicit Intent
Intent i = new Intent(getApplicationContext(), ActivityTwo.class);

startActivity(i);

4. Differentiate between Toast and SnackBar Messages. [6]


Toast Snackbar
Its main role is too visible The main role of a
the message’s feedback. snackbar is to receive the
action of the user.
These messages do not Snack bars contain the
contain an option box. option box.
The messages are visible While the snack bar
for a short time. messages are shown
unlimited times.
It appears anywhere on the Snackbar messages are
screen. shown down on the screen.
Toast messages cannot be Snack bars contain the
removed by users. option box.
Part B
5. Differentiate between any two types of Web Services. [6]
REST SOAP
REST stands for Representational State SOAP stands for Simple Object Access
Transfer Protocol
REST is a style of software architecture SOAP is a protocol or a set of standards
REST can use SOAP because it is a SOAP cannot use REST because it itself
concept and can use any protocol like is a protocol.
HTTP and SOAP
REST inherits security measures from the SOAP defines its own security layer
underlying transport protocols
REST accepts different data formats like, SOAP only works with XML format.
Plain Text, HTML, JSON, XML etc.
REST does not define too much standards. SOAP defines standards to be strictly
followed

6. How does the Transaction-Processing Architectural Pattern subscribe to principles of


good architectural design? [10]
 Divide and conquer: Dividing the system into client and server processes is a
strong way to divide the system and each can be separately developed.
 Increase cohesion: Server can each provide cohesive services to clients.
 Reduce coupling: There is usually only one communication channel exchanging
simple messages.
 Increase abstraction: Separate distributed components are often good abstractions.
 Increase reuse: It is often possible to find suitable frameworks on which to build
good distributed systems. Sample architectures already exist. However, client-
server systems are often very application specific.
7. Compare and contrast MVC and MVVM. [10]
MVS MVVM
Controller is the entry point to the The view is the entry point to the
Application. Application
MVC Model component can be tested Easy for separate unit testing and code is
separately from the user event-driven.
Difficult to read, change, to unit test, and The debugging process will be
reuse this Model complicated when we have complex data
bindings.
MVC is Old Model MVVM is a relatively New Model.

MVVM architecture facilitates a separation of development of the graphical user


interface with the help of mark-up language or GUI code. The full form of MVVM is
Model–View–View-Model. The view model of MVVM is a value converter that means
that it is view model’s responsibility for exposing the data objects from the Model in such
a way that objects are easily managed and presented. While MVC framework is an
architectural pattern that separates an applications into three main logical components
Model, View, and Controller. On the other hand MVVM facilitates a separation of
development of the graphical user interface with the help of mark-up language or GUI
code. In MVC, controller is the entry point to the Application, while in MVVM, the view
is the entry point to the Application. MVC Model component can be tested separately
from the user, while MVVM is easy for separate unit testing, and code is event-driven.
MVC architecture has “one to many” relationships between Controller & View while in
MVVC architecture, “one to many” relationships between View & View Model.

You might also like