Designing Windows Store Apps with HTML and JavaScript: An Overview
- 7/18/2014
Answers
This section contains the solutions to the thought experiments and answers to the lesson review questions in this chapter.
Objective 1.1: Thought experiment
- The My Restaurant app is great at helping users find the food they love. Of course, you can come up with other “great at” statements. The point is to choose one and use it to guide your app.
- You can use the Grid App template if you want to center your app on categories of food or recommendations.
- Yes. A restaurant attracts a variety of individuals, so you should anticipate that some might have disabilities.
Objective 1.1: Review
Correct answer: C
- Incorrect: Animations should be used in a Windows Store app. You can use the animations already created for you by Microsoft.
- Incorrect: You shouldn’t design your own animations. You want a consistent feeling across all apps, which is why Microsoft created an animation library.
- Correct: Animations should be used in your app. The documentation shows which animations are suggested by Microsoft, and your designer can use those animations in his design.
- Incorrect: You should use the animation library instead of creating completely custom animations.
Correct answer: D
- Incorrect: The platform supports apps of any size.
- Incorrect: Apps can support multiple user scenarios. They should use the “great at” statement to make sure that all scenarios contribute to one great user experience.
- Incorrect: Having an app that looks beautiful, is fast and fluid, and integrates with other apps doesn’t require a “great at” statement. The statement is about what your app does and the user experience it delivers.
- Correct: Your “great at” statement brings focus to your app and helps you to excel at what you want your app to do.
Correct answers: A, C, D, E, F
- Correct: Pride in craftsmanship is a Microsoft design principle.
- Incorrect: Cloud integration is not a Microsoft design principle.
- Correct: Fast and fluid is a Microsoft design principle.
- Correct: Authentically digital is a Microsoft design principle.
- Correct: Do more with less is a Microsoft design principle.
- Correct: Win as one is a Microsoft design principle.
Objective 1.2: Thought experiment
- It is true that a layered application initially adds complexity to your code. Code is spread over several files, and not all code is allowed to call all other code. However, this does increase maintainability and helps you to centralize code around specific tasks, which pays off in the end.
- This is not true. When a layer defines its interface, other layers can depend on those interface definitions. An implementation could then be faked (such as a static set of test data). You could also implement your application in vertical slices of functionality by developing all layers simultaneously instead of layer by layer.
- Although JavaScript was not created with large-scale applications in mind, you can certainly create a good architecture in JavaScript. Another way is to use TypeScript to extend JavaScript and make it more suitable for large-scale applications.
Objective 1.2: Review
Correct answer: A
- Correct: The data layer is responsible for fetching data from an external web service.
- Incorrect: The service layer is not meant to fetch data from external resources. Instead, it should coordinate actions in your own app.
- Incorrect: The business layer enforces business rules and functionality; it does not communicate with external web services.
- Incorrect: The UI layer should not communicate with external data sources.
Correct answer: C
- Incorrect: Sharing data should not be done through global state because it might create unwanted side effects.
- Incorrect: You can avoid global state by scoping data to the containing function.
- Correct: Avoiding global state creates a better maintainable app.
- Incorrect: Global state is possible in every JavaScript project.
Correct answers: A, B, C, D
- Correct: Creating classes is a core element of building a layered application.
- Correct: Namespaces group classes, which helps you separate code into distinct areas.
- Correct: WinMD Components can be used to create C# assemblies. This separation in assemblies automatically creates a separation in your code.
- Correct: A web service is a distinct tier of your application that can host one or more layers.
Objective 1.3: Thought experiment
- Windows Store apps can save data to a roaming folder, which is automatically synced between all user devices.
- By handling the checkpoint event, you can save data before the app is suspended. When resuming from a terminated state, you can then restore this data.
- When resuming your app, you need to restore data from the user’s folder, but you should also make sure that data is not out of date. By using your activated event, you can refresh your external data.
Objective 1.3: Review
Correct answers: B, C
- Incorrect: A game needs state management just like every other app. Make sure that users can continue playing games from the moment they left.
- Correct: The activated event should be used to restore any state after the app terminated.
- Correct: The checkpoint event can be used to save state before the app is suspended and eventually terminated.
- Incorrect: The terminated event does not exist.
Correct answer: B
- Incorrect: Starting with Windows 8.1, you should completely refresh any data only if the user returns within 10 seconds after closing the app.
- Correct: If a user doesn’t launch the app within 10 seconds, treat the close action as a normal suspend and terminate.
- Incorrect: This is never an option. You should not show unnecessary dialog boxes to the user.
- Incorrect: Restarting the application is not an option. You can decide what you want to do with the current application state. However, you should try to follow the required action of resuming the app if the user does not return within 10 seconds.
Correct answer: D
- Incorrect: This is a DOM event that you don’t have to use inside your app. WinJS offers convenient events that map to your app life cycle.
- Incorrect: This is a DOM event that you don’t have to use inside your app. WinJS offers convenient events that map to your app life cycle.
- Incorrect: The checkpoint event should be used to save any state before the app is suspended.
- Correct: A web service is a distinct tier of your application that can host one or more layers.
Objective 1.4: Thought experiment
- Yes, especially because your app will be deployed to the public Windows Store. For the internal distributed apps, it is also a good idea to follow all certification requirements.
- The manifest enables you to specify different files for screen shots, tiles, and the splash screen. Other branding can be done like any HTML and CSS app. You can configure different images and CSS files to style your app.
- No, this certificate is generated when publishing your app to the Windows Store. For internal distribution, you need to sign your app.
Objective 1.4: Review
Correct answers: A, B, C, D
- Correct: All your content files are included in the package.
- Correct: The block description is included, which is used to split your app into smaller chunks to make the update process easier.
- Correct: A certificate is required for signing your app.
- Correct: A manifest is required to describe your app. It is used to show your app in the Windows Store, and to install and run the app on a user’s device.
Correct answer: B
- Incorrect: The client and server requirement is used only if your app receives requests from external sources. You are connecting only from your app to an external web service.
- Correct: It allows you to connect to your web service.
- Incorrect: A private network is required only when you want to connect to other devices inside the network; for example, inside a domain or inside a home network.
- Incorrect: The home network option does not exist.
Correct answer: B
- Incorrect: Installing Visual Studio and having access to the source is not required, and it would probably be too much work for testers.
- Correct: Windows PowerShell scripts can install the app locally and test it.
- Incorrect: A Windows Installer is not required. An app package can be installed with the generated Windows PowerShell scripts.
- Incorrect: If you want users to test your app, you should not submit it to the Windows Store. That way, everyone can access your app. And because your app is not yet ready, it will probably fail submission.