Front-End Development Flashcards

1
Q

Describe the primary characteristics and technologies used in the first-generation web application frameworks.

A

First-generation web application frameworks, such as PHP, ASP.net, and Java servlets, incorporated language runtime systems into the web server. They introduced templates that mixed code and HTML, and provided web-specific library packages for URL handling, HTML generation, sessions, and interfacing with databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Considering the Common Gateway Interface (CGI) in early web applications, explain how the notion of stateless servers made scale-out architectures easier.

A

The Common Gateway Interface (CGI) introduced the concept of stateless servers, where each request is independent, and no state is carried over from previous requests. This approach made scale-out architectures easier because it allowed for the distribution of requests across multiple servers without the need for maintaining state information, thereby facilitating scalability and load balancing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Compare and contrast the second-generation and third-generation web application frameworks, focusing on their main innovations and architectural differences.

A

Second-generation frameworks like Ruby on Rails and Django introduced the model-view-controller architecture and object-relational mapping (ORM) for simpler database interactions. In contrast, third-generation frameworks like AngularJS emphasized JavaScript frameworks running in the browser for more interactive and responsive applications. They reduced the need for server round-trips and were often used with technologies like Node.js and No-SQL databases, yet maintained many concepts from previous generations, including model-view-controller and templates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the role of the Model in the Model-View-Controller (MVC) pattern?

A

In the Model-View-Controller (MVC) pattern, the Model is responsible for managing the application’s data and rules. It represents the application’s dynamic data structure, independent of the user interface, and directly manages the data, logic, and rules of the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain how the Controller in the MVC pattern interacts with the other two components in the context of a photo application.

A

In the MVC pattern, within a photo application, the Controller serves as an intermediary between the Model and the View. It receives user inputs and initiates responses by making calls to Model objects to retrieve data, then decides which View to display. For example, it might handle DOM event handlers and communicate with the web server to fetch photos and comments (Model) and update the user interface (View) accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Discuss the historical origins of the Model-View-Controller (MVC) pattern.

A

The Model-View-Controller (MVC) pattern originated in the late 1970s as part of the Smalltalk project at Xerox PARC. It was developed as a way to organize code in applications with graphical user interfaces, which were becoming more complex. This pattern was designed to break down these applications into more manageable pieces, separating data (Model), user interface (View), and the logic that connects the two (Controller).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the role of templates in view generation for web applications?

A

In view generation for web applications, templates play a crucial role by providing a structure where static HTML content is combined with code snippets that dynamically generate parts of the page. These templates are expanded by executing the code snippets, allowing for the seamless integration of dynamic content into the HTML structure, thus creating a dynamic web page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Compare the use of templates with direct JavaScript to DOM programming for view generation in web applications, focusing on benefits and use cases.

A

Templates offer several benefits over direct JavaScript to DOM programming for view generation in web applications. They make it easier to visualize the HTML structure and see how dynamic data fits into the page. Templates can be used on both the server and the browser, providing flexibility in implementation. In contrast, direct JavaScript to DOM programming involves manipulating the document structure programmatically, which can be more complex and less intuitive when dealing with dynamic content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In the context of AngularJS, explain how dynamic content is integrated into a web page using the view template example, where placeholders like ‘{{models.user.firstName}}’ and ‘{{models.photos.count}}’ are used.

A

In the AngularJS view template example, dynamic content is integrated using placeholders within the HTML structure, like ‘{{models.user.firstName}}’ and ‘{{models.photos.count}}’. These placeholders are replaced with actual data values when the template is processed, allowing for the dynamic generation of content specific to the user’s context, such as displaying the user’s first name and the count of their photos.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain the responsibilities of controllers in third-generation web applications and how they interact with models and views.

A

In third-generation web applications, controllers are responsible for linking models and views. They manage server communication to fetch model data and push updates, control which view templates are displayed, and handle user interactions like buttons and menus. Controllers ensure that the user interface reflects the current state of the model and respond to user inputs, updating the model and view accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Provide an example of how a controller is implemented in AngularJS, including its role in managing user interactions.

A

In AngularJS, a controller is implemented as a JavaScript function. For example, the userGreetingView function manages user greetings. It uses $scope to bind data and functions to the view, fetching user and photo data from a model service. The function includes specific methods like okPushed() to handle actions like button presses. AngularJS creates $scope and calls the controller function when the view is instantiated, allowing the controller to manage user interactions and update the view based on model data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Compare the role of controllers in third-generation web applications to their function in earlier web application frameworks.

A

Fourth-generation web application frameworks place a greater emphasis on software engineering principles such as modular design, reusability, and testability. They view applications as collections of reusable components, in contrast to the page-focused approach of earlier frameworks. Earlier generations focused more on integrating programming languages with web servers (first-generation) and adopting architectural patterns like MVC (second-generation), while the component-based approach of fourth-generation frameworks represents a shift towards building more scalable and maintainable applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Describe the nature of model data in web applications and its traditional relationship with the application’s database schema.

A

Model data in web applications consists of all dynamic information required by view templates and controllers. Traditionally, it is closely tied to the application’s database schema, often represented using Object Relational Mapping (ORM), where each model corresponds to a table row in the database. This setup allows the model data to be persisted and managed efficiently through the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain how AngularJS handles model data, including its support for fetching data from a web server.

A

AngularJS does not specify the structure of model data, allowing it to be composed of JavaScript objects. The framework provides support for fetching data from a web server, typically using REST APIs and JSON for data exchange. This approach enables AngularJS applications to retrieve and manage dynamic model data from server-side sources efficiently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Discuss the conflict between the need for frequently changing web application model data and the relative inflexibility of database schemas. How can this be addressed?

A

The conflict arises because web application model data often needs to change frequently to improve user experience, while database schemas prefer stability and are resistant to frequent changes. This can be addressed by using flexible data structures like NoSQL databases, which allow for more dynamic data models, or by designing database schemas with future modifications in mind, ensuring they can accommodate changes without extensive restructuring.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Object-Relational Mapping (ORM) and how does it facilitate interactions between a relational database and an object-oriented programming language?

A

Object-Relational Mapping (ORM) is a technique that creates a virtual object database which can be used from within a programming language. It allows developers to manipulate database data using the constructs of their programming language, rather than writing SQL queries. ORM translates these programming language operations into SQL queries and executes them in the database, returning results that are automatically mapped back into objects. This process streamlines database interactions in application development.

17
Q

What are some common use cases for timer events in web development?

A

Common use cases for timer events in web development include creating animations, implementing automatic page refreshes, delaying actions until a specific time has elapsed, and periodically checking or updating data without user intervention.

18
Q

How are events processed in terms of concurrency in the DOM?

A

In the DOM, events are processed in a serialized, one-at-a-time manner, without interleaving with other JavaScript execution. Event handlers run to completion before any other scripts or handlers, ensuring no multi-threading and simplifying concurrency management.

19
Q

What are the implications of the DOM’s single-threaded event handling for background processing?

A

The single-threaded nature of the DOM’s event handling makes background processing more challenging, as there are no separate threads to handle tasks concurrently. This means long-running event handlers can block other scripts, impacting the user experience. Developers often rely on asynchronous programming patterns like promises and async/await to manage background tasks effectively.

20
Q

What is event-based programming, and what are its key characteristics in the context of the DOM?

A

Event-based programming involves writing code that runs in response to events. Key characteristics include waiting for events to invoke code, needing handlers to return quickly to avoid locking up the application, and maintaining control through sufficient event handlers and timers.

21
Q

How does event-based programming impact the development of server-side applications in Node.js?

A

Event-based programming is central to Node.js, impacting server-side development by enabling efficient handling of numerous simultaneous connections through non-blocking, asynchronous operations. This model allows Node.js applications to efficiently manage resources and scale effectively, particularly in I/O-intensive scenarios.