BTI420 notes – Tue Apr 14

Test 2, written part.

.

In-class, written evaluation (Test 2)

We’ll start at 8:45am.

This part of the test is worth 6% of your final course grade.

The duration of the test is forty-five (45) minutes. If you arrive/start late, you will not get extra time.

.

What to expect

It will cover web app programming, all topics from study week until now.

The question style and format will be similar to those on the quizzes and on Test 1. You may be asked about factual information, as well as concepts, which will give you an opportunity to demonstrate reasoning, analysis, and synthesis skills.

.

Reference material

For this written portion of the test, reference material is not permitted.

.

Some advice about the written portion of the test…

To be successful in this Software Development program, you must be able to explain a topic or concept, and you must be able to apply a topic or concept.

The written portion of the test gives you an opportunity to briefly explain one or more topics or concepts.

When reviewing the course materials, simply ask yourself “can I explain that topic or concept”? If you can answer “yes”, and can compose a brief and clear answer, then you’re well-prepared for the test.

.

How to prepare for the test

Review your hand-written and/or digital notes.

Review the course notes. Every page. Every section. Every word.

Follow the links in the course notes and the readings – read, understand, and apply the readings.

Know how to explain concepts, and draw simple diagrams where appropriate.

Know and understand the reasons for some of the design and coding decisions we make.

.

Reminder about Course policies

This is a reminder: Review the Course policies document. In particular, make sure you read and understand the information about “Tests and Other Graded Work”.

.

Test 1, and sample answers

Test 1 has been graded, and the results posted to My.Seneca/Blackboard.

For students in Section A, your test paper will be returned during our class/session on Monday, April 13.

For students in Section B, if you are on-campus and want your test, you can visit your professor in his office. He will be in or near his office during the morning (and then will be in-class at 1:30pm). Alternatively, you can visit on Tuesday, April 14, from 7:45am to 8:30am (just before the Test 2 written part).

.

Sample answers for Test 1

The sample answers are just that – sample answers. It is not necessary to include all items in a sample answer in order to earn partial or full credit.

.

Discuss how to implement input data validation. (e.g. How is it done? Where?) (2 marks)

View model classes have data annotations
Use proper HTML Helpers (e.g. EditorFor, or EditorForModel)

In the method that handles posted data, validate with ModelState.IsValid

.

Briefly discuss a strategy for displaying associated objects in a ‘details’ view. (2 marks)

This works for a single object, and for a collection of objects
View model class must include a suitable property to hold the associated object(s)

Obviously, AutoMapper support must be there
The Manager method (that fetches the object(s)) must use the Include() method

.

When working with a collection, what does ‘filtering’ mean, and how is it done?

The process of selecting objects that match a search condition
Done with the Where() method (and a lambda expression)

.

In a web app that uses the Entity Framework, describe the programmatic path taken by an <entity>Add object that enters a controller’s Create() method from an HTML Form, and saved in a database-hosted persistent store. Name and briefly describe the objects involved. (2 marks)

<entity>Add object
Controller passes it to the Manager method

AutoMapper is involved here too
Manager adds an object to the data context, and configures it
Calls SaveChanges()
Entity Framework persists the object to the store

.

We have modified the MvcApplication class several times now. Briefly explain a typical modification that we have made to this file.

AutoMapper mappings
StoreInitializer for persistent storage
Error-handling methods

.

What is the purpose of _Layout.cshtml? Briefly describe what it contains.

Purpose is to provide a common visual layout template for views
HTML markup, including the document structural tags, and C# code expressions

.

Name two kinds of members that can be added to a class. Briefly explain the purpose of one of these members.

Field – Variable with local class scope, not public
Property – Store data or state for the class. Public.
Method – Behaviour or functionality for the class. Public or private.
Constructor – Method that’s called when the object is created.
Others include Constant, Event, Indexer, Destructor, Nested typePrivate fields/variables

.

Name and briefly describe the best practice return result from a method that handles an HTTP POST.

Use the PRG pattern (post-redirect-get)
All return code paths must return a RedirectToAction() result

.

Explain the difference between a view model class and a design model class.

View Model – Describes the shape of data sent to the user, or gathered from the user, for a use case.
Design Model – Definition of real-world objects being modeled and persisted.

.

Assume that you are writing code in the Manager class. When fetching one or more objects from a persistent store, how can you fetch the associated object(s)? Briefly explain.

Associated objects are not fetched, by default.
Must use the Include() method, and name the desired navigation property.

.

How do we seed the persistent store with initial data? Briefly explain the process.

Store initializer class.
Create and configure objects, save them.
Call from MvcApplication class when the app starts.

.

A few weeks ago, you learned the ‘add new’ pattern. More recently, you learned the ‘edit’ and ‘delete’ patterns. What’s similar among them, and what’s different? (2 marks)

All require two methods, and use the PRG pattern.
All require Manager class methods.
Edit request requires two data validation checks, 1) model validation, 2) object identifier.
Delete request does not typically return data to the end user. 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: