Home > Sample chapters

Designing Windows Store Apps with HTML and JavaScript: An Overview

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

  1. 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.
  2. You can use the Grid App template if you want to center your app on categories of food or recommendations.
  3. Yes. A restaurant attracts a variety of individuals, so you should anticipate that some might have disabilities.

Objective 1.1: Review

  1. Correct answer: C

    1. Incorrect: Animations should be used in a Windows Store app. You can use the animations already created for you by Microsoft.
    2. Incorrect: You shouldn’t design your own animations. You want a consistent feeling across all apps, which is why Microsoft created an animation library.
    3. 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.
    4. Incorrect: You should use the animation library instead of creating completely custom animations.
  2. Correct answer: D

    1. Incorrect: The platform supports apps of any size.
    2. 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.
    3. 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.
    4. Correct: Your “great at” statement brings focus to your app and helps you to excel at what you want your app to do.
  3. Correct answers: A, C, D, E, F

    1. Correct: Pride in craftsmanship is a Microsoft design principle.
    2. Incorrect: Cloud integration is not a Microsoft design principle.
    3. Correct: Fast and fluid is a Microsoft design principle.
    4. Correct: Authentically digital is a Microsoft design principle.
    5. Correct: Do more with less is a Microsoft design principle.
    6. Correct: Win as one is a Microsoft design principle.

Objective 1.2: Thought experiment

  1. 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.
  2. 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.
  3. 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

  1. Correct answer: A

    1. Correct: The data layer is responsible for fetching data from an external web service.
    2. Incorrect: The service layer is not meant to fetch data from external resources. Instead, it should coordinate actions in your own app.
    3. Incorrect: The business layer enforces business rules and functionality; it does not communicate with external web services.
    4. Incorrect: The UI layer should not communicate with external data sources.
  2. Correct answer: C

    1. Incorrect: Sharing data should not be done through global state because it might create unwanted side effects.
    2. Incorrect: You can avoid global state by scoping data to the containing function.
    3. Correct: Avoiding global state creates a better maintainable app.
    4. Incorrect: Global state is possible in every JavaScript project.
  3. Correct answers: A, B, C, D

    1. Correct: Creating classes is a core element of building a layered application.
    2. Correct: Namespaces group classes, which helps you separate code into distinct areas.
    3. Correct: WinMD Components can be used to create C# assemblies. This separation in assemblies automatically creates a separation in your code.
    4. Correct: A web service is a distinct tier of your application that can host one or more layers.

Objective 1.3: Thought experiment

  1. Windows Store apps can save data to a roaming folder, which is automatically synced between all user devices.
  2. 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.
  3. 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

  1. Correct answers: B, C

    1. Incorrect: A game needs state management just like every other app. Make sure that users can continue playing games from the moment they left.
    2. Correct: The activated event should be used to restore any state after the app terminated.
    3. Correct: The checkpoint event can be used to save state before the app is suspended and eventually terminated.
    4. Incorrect: The terminated event does not exist.
  2. Correct answer: B

    1. Incorrect: Starting with Windows 8.1, you should completely refresh any data only if the user returns within 10 seconds after closing the app.
    2. Correct: If a user doesn’t launch the app within 10 seconds, treat the close action as a normal suspend and terminate.
    3. Incorrect: This is never an option. You should not show unnecessary dialog boxes to the user.
    4. 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.
  3. Correct answer: D

    1. 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.
    2. 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.
    3. Incorrect: The checkpoint event should be used to save any state before the app is suspended.
    4. Correct: A web service is a distinct tier of your application that can host one or more layers.

Objective 1.4: Thought experiment

  1. 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.
  2. 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.
  3. 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

  1. Correct answers: A, B, C, D

    1. Correct: All your content files are included in the package.
    2. Correct: The block description is included, which is used to split your app into smaller chunks to make the update process easier.
    3. Correct: A certificate is required for signing your app.
    4. 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.
  2. Correct answer: B

    1. 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.
    2. Correct: It allows you to connect to your web service.
    3. 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.
    4. Incorrect: The home network option does not exist.
  3. Correct answer: B

    1. Incorrect: Installing Visual Studio and having access to the source is not required, and it would probably be too much work for testers.
    2. Correct: Windows PowerShell scripts can install the app locally and test it.
    3. Incorrect: A Windows Installer is not required. An app package can be installed with the generated Windows PowerShell scripts.
    4. 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.