concept user in category f#

appears as: user, users, users, The user, User
F# Deep Dives

This is an excerpt from Manning's book F# Deep Dives.

Table 1. Business problems and their implications
 

Problems

Implications

Correctness As computers become more efficient, financial and actuarial models grow increasingly complicated. The amount of available data grows equally quickly, so algorithms that process this data become more advanced. Maintaining the correctness of such systems raises many problems. It becomes difficult to add new features without breaking existing code, and systems may break as data sources and formats evolve. In settings where models are developed by researchers and are later reimplemented by developers for production code, it’s hard to keep the two in sync. An incorrect system that produces incorrect values can easily lead to wrong decisions being made. If a user interface displays a picture incorrectly, your user will likely be annoyed, but they won’t lose money. But money can easily be lost if something goes wrong in an analytical component of a financial system. An infamous example of a correctness problem was the Mars Climate Orbiter probe launched by NASA in 1998. The probe failed during launch because one part of the system was using metric units (force measured in Newtons) and another was using imperial units (measured in pound force). Even when incorrect systems don’t have such massive consequences, they may lead to buggy services and the loss of reputation for the company, or to buggy products and a loss of customers.
Time to market Another important consideration for analytical and data-rich components is the time to market—how much time is needed before an initial idea can be turned into production-quality code. For example, a financial company might have a research department that develops models in statistical or numerical environments like R and MATLAB. When a model is designed and tested, it’s passed to developers who translate the models to C++ for deployment to production. Such translation can easily take six months. Consider another example from the social gaming domain. A quick release cycle is important to make sure that your players keep getting new features, or even new games, every few weeks. In the financial sector, the inability to turn a new mathematical model into a system that can be used in production might mean the business loses an opportunity that exists only in a short timeframe. In the social gaming world, a company will quickly lose players if the games aren’t rapidly updated or new features aren’t added. The time to market is also important in the startup world, which is symbolized by the phrase “fail fast.” You want to be able to develop initial prototypes quickly, so that you can immediately verify the viability of some idea. If the prototype does work, you should also be able to quickly turn it into a complete project.
Efficiency and scalability Two related concerns are efficiency and scalability. Efficiency is mainly important for computationally heavy software such as financial models. For example, models that were originally developed by researchers in R or Python need to be translated to more efficient C++ code or optimized Python. If the researchers were able to write their models more efficiently, then the translation step wouldn’t be needed. Scalability matters even for software that doesn’t perform heavy computations. A server-side application (such as a social game backend) or UI (a game frontend) needs to handle multiple concurrent requests or user interactions. Efficiency and scalability have varying importance in different contexts. A common case for efficiency in financial systems is that models need to be recalculated overnight, so there’s a hard limit. Failure here means up-to-date information isn’t available. Similarly, when serving a web page with ads, the ad service needs to choose an appropriate ad based on the user’s information almost instantly. As for scalability, server-side code that doesn’t scale will consume excessive resources and make maintenance costly. On the client side, nonscalable applications can hang and lead to a poor user experience.
Complexity Analytical and data-centric components are usually the parts of an application that implement advanced logic. They provide value by implementing mathematical models, data analyses, or processing of concurrent events. In a poorly designed system, complexity can easily grow beyond a tractable level, most commonly because different features that should be independent interact in unexpected ways. As a result of increasing complexity, your company might not be able to implement a desired financial model, AI behavior, or data analytical component, because it’s too complex. As a result, you won’t be able to provide the data that users and customers need (or not at the required quality), or an entire project or product may fail. In other words, without the right tools, you’ll often have to settle for a suboptimal solution.

This chapter looked at part of the F# community on Twitter and gave you some new insights into this community. You determined which users are important in the network and which users play the role of hubs. You also produced several different plots to analyze various aspects of the network’s structure.

Figure 1. The sample application: the user has entered a security symbol and started the price feed.
Real-World Functional Programming with Examples in F# and C#

This is an excerpt from Manning's book Real-World Functional Programming with Examples in F# and C#.

The framework splits the input data into partitions and executes the map task (using the first operation from the user) on each of the partitions. For example, a map task may find the most important keywords in a web page. The results returned by map tasks are then collected and grouped by a specified key (for example, the name of the domain) and the reduce task is executed for each of the groups. In our example, the reduce task may summarize the most important keywords for every domain.

Listing 16.6 shows the typical way of working with events in a type declaration. We store the instance of the Event class as a local value ❶ and we expose the event value returned by the Publish member as a public member of the class ❷, so that the users can listen to the event but can’t trigger it. When the appropriate condition is met, we raise the event using the Trigger member ❸.

One problem that’s surprisingly difficult to solve in a functional way is the user interaction when drawing graphical objects on a Windows Forms control. Suppose we want to draw a rectangle so that the user starts by pressing the mouse button in one of the corners, moves the cursor to the opposite corner, then releases the button. While moving the cursor with the button pressed, the application should draw the current shape of the rectangle, and when the button is released, it should be finally applied to a bitmap or stored in the list of vector shapes.

A typical imperative implementation would use a mutable flag specifying whether we’re currently drawing and a mutable variable to store the last location where the user pressed the mouse button. Then we’d handle MouseDown and MouseMove events and modify the state appropriately when one of them fired. We can check whether the drawing is finished in the handler for the MouseMove event, because it also carries information about the state of mouse buttons. Alternatively, we could use the MouseUp button, but the first version will be easier to start with. If we think of the control flow of the application, we can see that it’s quite simple. You can see a flowchart that shows it in figure 16.5.