Suvichara

Archive for June, 2007

Gaming Industry comes full circle…

Posted by Prashant Hegde on June 26, 2007

Nintendo is back at no 1 again. According to this article in CNN Money, which analyzes why Sony lost -

There are a number of lessons we can glean from this — not just for the future of videogame consoles, but the future of consumer electronics. Decades from now, PS3 vs. Wii will be remembered as a cautionary business tale: how pride, politics, and an overabundance of technology can blind you to the simple truth of what consumers want.”

While Sony chose to make its Play Station more powerful and more feature rich, Nintendo concentrated on usability and cost. As the article says -

“Why change something that is already installed in 200 million homes worldwide? Answer: because there are more people in those homes that don’t play games, and hundreds of millions more homes to win over”.

The article further comments on Sony’s and Microsoft’s strategy of adding more and more technology-

“You buy them for the games, but once inside your home, they take over your life. They become the brains of your TV, your entertainment center, even your main communications device with IP telephony and chat functions. They converge all your technological needs in one box. (Microsoft, at least, didn’t assume that we would only want to use its technology in this converged device; it allowed you to plug in your iPod to the Xbox 360.)”

While Nintendo’s strategy was -

“…. When you buy a videogame console, the company says, you want to play games. Period. A console is not a Swiss Army knife. It makes sense to squeeze more functionality into your cell phone because you carry that device around everywhere. When it comes to the interactive fun box in your living room, however, it makes sense to simply make that more fun. If you want a DVD player, you’ll buy a DVD player. “

While Sony and Microsoft sell their gaming consoles at a loss, Nintendo actually makes profit on the sales. Sony is paying for forgetting what the customer wants.

This is how it typically works. Initially, when products come onto the market, they all look alike. In order to differentiate their products, manufacturers add more features. It is these features that differentiates the products in the market and help gain market share. However, if you take this strategy too far, it back fires. But, the question is – ‘how to decide when to stop?’. It is not easy to decide when to stop. Sony, apparently, did not know where to stop.

In his book “Design of Everyday Things”, Donald Norman talks about “technology paradox”. He says products follow a ‘U’ shaped curve. When things are complex, a new technology helps to bring it down. However, once the complexity is brought down, more and more features are added which makes it complex again and the cycle repeats!..

Posted in Ramblings | 1 Comment »

UML Activity Diagrams 101

Posted by Prashant Hegde on June 23, 2007

One of the unique features offered by the Activity diagrams is – it makes possible to combine non-Object Oriented (referred to as OO) modeling with OO modeling. Most of the times than not, people use specialized non-OO libraries in their OO design. UML activity diagrams make modeling of non-OO library calls possible in their OO designs. Similarly, Activity diagrams can be quite useful for Business Process Modeling for enterprise modelers or for modeling the flow of information, control, energy etc for System Engineers. It can be used, for example, to graphically detail use cases. It can also be quite useful for project managers/system Engineers represent the project/product development process. People who are familiar with Petri nets, Data Flow, Control Flow Diagrams will find themselves at home with Activity Diagrams. Another important addition to Activity diagrams is the addition of parameter nodes (technically, they are object nodes) that allows the invoker to pass parameters to the model and receive output from the Activity. Activity diagrams can be invoked from other Activity diagrams thus making them reusable.

The activity model is defined with semantic variations, which means that the runtime behavior might vary from implementation to implementation and the modeler can choose the behavior that is appropriate. The basic constructs of Activity diagrams are – Action Nodes, Control Nodes (Decision nodes, Fork and Join, Initial Node, Finals Nodes) and Object nodes.

  • Action nodes represent behaviors, which can be – Activities, State machines or interaction diagrams. They consume control and data (referred to as tokens) and output control and/or data. Actions could be – create object, set object or invoke some behavior. Note that the actions can be represented as a function in procedural language like – C or as a method in OO languages, or as a class with behavior in OO languages. Actions are the only constructs in UML that can invoke operations on objects. Note that each action node may have more than one input (control and/or action). The action is triggered only when all the inputs are available. When the activity ends data/control is placed on the outgoing nodes (object node or control flow).
  • Control nodes are used for controlling data/control flow through the diagram based on decisions or provide parallel paths for data/control flow or terminating an activity.
    • An activity diagram can contain more than one start nodes. An activity will start at all these nodes simultaneously. So, it is better to have a single start node to avoid confusion.
    • Decision nodes help route flow to different paths in the diagram based on the evaluation of guard conditions placed on each path. Care should be taken not to have more than one guard condition evaluating to true at the same time. Another useful thing to remember is – guard conditions should not have any side effects. Decision nodes can be chained. Note also that decisions nodes can invoke other Activities to decide routing.
    • Merge Nodes are used to merge multiple flows. Just like the decision nodes merge nodes can be chained.
    • Fork Nodes split flows into more than one simultaneous flow. Data / Control are simply copied onto each path.
    • Join nodes synchronize multiple flows. Note that if there are multiple control tokens coming into the join nodes they will be merged into a single token. If there are both control and data tokens only data tokes are copied onto the outgoing flow. No control tokens are copied. Also, modelers should pay attention not to have any flow final nodes in one of the join paths, which would otherwise make the next action wait indefinitely if the flow is terminated. Like merge nodes join nodes can also be chained.
    • Flow final nodes receive control / data tokens and do nothing. Effectively, they end the flow in that path.
    • Final nodes end an activity when any token is received. This can be used instead of flow final as this node will terminate the entire activity including other concurrent paths.
  • Object nodes act as placeholders for data as it moves along the path. Object nodes can hold single token, multiple tokens, buffering, backup, central data store etc. The object nodes can optionally contain the state of the object. The object can also be a group of data. Object nodes can traverse the edge only when all the input-output pairs are ready. Central buffers can be used when it is necessary to allocate to token to different competing destinations.

Activities can be connected to other activities directly when they carry control or through object nodes when they carry data. As mentioned above Actions start as soon as all the inputs are available. However, streaming parameters are exceptions to this rule. Streaming parameters can accept and output parameters while an action is executing (at least one input must arrive for the action to begin). Apart from normal output parameters the action can also output exceptions as well indicating an exceptional condition. When an exception is output, other outputs are not defined. Note also that exception outputs cannot be streaming. It is also possible to group parameters (called Parameter Sets) such than exactly one of them accept or provide values. Constraints such as pre-conditions, post-conditions can be applied to actions, which can be specific to a particular invocation of a behavior or could apply to all invocations of that behavior. The other useful feature of Activity diagrams is the swim-lane notation. Swim lanes group activities. A swim lane for example could represent a department and its responsibilities or different hardware or different components or different classes or attributes etc.

For more information, interested readers may consult a series of 6 articles by Conrad Bock(Conrad Bock: UML 2 Activity and Action Models” )

Posted in Modeling-Simulation, Systems Engineering | Leave a Comment »

The Risk and Uncertainty debate…

Posted by Prashant Hegde on June 15, 2007

There is a lot of discussion about the differences between risk and uncertainty. There is no universal agreement on the differences between two terms and the debate is still on!

Quoting Frank Knight – “It will appear that a measurable uncertainty, or “risk” proper, as we shall use the term, is so far different from an unmeasurable one that it is not in effect an uncertainty at all. We … accordingly restrict the term “uncertainty” to cases of the non-quantitative type..”. This essentially means that risk can be quantified in terms of probabilities where as uncertainty is not. According to Knight, there are two types of probabilities – objective and subjective. A probability is called objective probability if any of the following conditions are true -

  • When there is symmetry in the information ( for eg: tossing a coin )
  • Statistical analysis of experimental data is possible

He considered other probability assessments subjective( or as ‘personal probability’ as some authors prefer to call it). He considered subjective probabilities as uncertainties and not as risks. As some critics noted, there may exist more than one symmetry in a given situation and hence the probabilities might differ from person to person. And, hence the first condition is really subjective. In the real world scenario, we rarely get enough experimental data to carry out statistical analysis on them and deduce probabilities from them. Hence, the the second condition is also very difficult to achieve in practice. Even if we have enough data on a given situation how are we sure that we have complete data and not ignored relevant data. So, we can say most of the times we only have subjective probabilities. So, we can not really make a distinction between risk and uncertainty. Other authors have the view point that calculation of probabilities is inherently subjective and advise that expert opinions should be considered while calculating probabilities. So, this process is more like a Bayesian than a frequentest approach.

Even though there are other theories to distinguish between the two, no theory is able to explain the differences between the two terms convincingly. So, most people use them interchangingly. Many people use the risk in a negative sense( i.e as a threat) and treat uncertainty as both positive ( i.e opportunity ) and negative. PMBOK, for example, uses the term risk in both the positive and negative sense. Design For Six Sigma (DFSS) considers risk in the negative sense. It uses Risk Priority Numbers(RPNs) to quantify risks. System Safety Engineering carries out Hazard analysis to identify risks within the system to be built so that they can be managed safely. Some authors advise using options theory to deal with uncertainties. They advise building flexible systems so that favorable events can be exploited when they arise and the impact of unfavorable events are minimized.

Posted in Ramblings | Leave a Comment »

Statecharts and tools…

Posted by Prashant Hegde on June 11, 2007

Statechart(also called state machine) diagrams are one of the most powerful modeling constructs available to modelers. It is used to model reactive systems. By reactive, we mean, that part of the system that responds to external events or operations.

In UML, classes can have statecharts as part of their behavior. Modeling the reactive behavior using Statecharts makes designs more manageable, easy to debug, easy to maintain and, of course, more understandable. The CASE tools depend heavily on Statecharts for the code generation.

Rhapsody is one of the UML modeling tools that has provided extensive Statechart modeling support for modeling embedded systems. Rhapsody also provides an OS independent Object Execution Framework(OXF) implemented in C++ that provides base classes, an event loop for dispatching events, event queues for storing events etc. The modeler can concentrate on modeling the solution and not worry about its implementation. Rhapsody generates all the code for you!. There is also a another framework called IDF that implements the Statemachine in C and is suitable for systems where memory and performance are a concern. Rhapsody also provides animation support debugging state machine logic.

Apart from UML tools, there are other tools that support Statechart modeling. I am listing some of them here. Telelogic’s Statemate is a very popular too for modeling embedded systems. Mathworks’  Stateflow is another. Berkeley University’s Ptolemy is a popular simulation tool that supports Statechart modeling.

Quantum Leaps is a company that provides a framework for implementing Statecharts that is suitable for embedded systems. Boost is an open source C++ template library that provides a Statechart library.

Powered by ScribeFire.

Posted in Modeling-Simulation | Leave a Comment »

Implementing your own Domain Specific Language(DSL)

Posted by Prashant Hegde on June 7, 2007

DSLs are gaining importance again. Thanks to UML. UML did not live up to its promise. The problem with UML is- it is too generic and very vast. The semantics of UML is also not clearly defined. The vastness deterred people from learning it and lack of precise semantics made people frustrated. Lots of time and money has been spent in the industry on learning UML, UML tools. But, the usefulness of these tools still remains a question for many.

MDA(Model Driven Architecture) gave the promise that people just need to do only modeling and write no code. Code is generated from the model. People can ‘execute’ models, ‘debug’ models and ‘deploy’ models. Even though the concept looks good, there are lots of practical limitations in implementing this concept. There is hardly any tool in the market that fully implements MDA. One of the ways people build executable models today is by ‘writing’ code within models!

Realizing this, Microsoft started promoting DSLs. It is one of the important tools that is part of their Software Factory concept. DSLs are custom languages for a domain. For ex: regular expressions, which you might me familiar with, is a DSL that is used for matching patterns within a given text etc. Microsoft developed DSL Tools SDK that allows users develop their own DSLs. This DSL SDK is now part of Visual Studio. Apart from Visual Studio, you can use various open source tools for building your own DSL. Vanderbilt university’s – Generic Modeling Environment(GME) is a popular meta-modeling tool that can be used for building DSLs. Honeywell’s DoME is another free meta-modeling tool. Eclipse has limited support for building DSLs. MetaEdit+ is a popular commercial DSL tool from Metacase. You can also build text based DSLs based on Lex, Yacc, ANTLR etc.

Building your own DSL(s) is less complex, easy to learn and, also, better auto source-code generation is possible from them. You can build your own Language Workbenches( see article from Martin Fowler on this) using these DSLs for example…

Posted in Modeling-Simulation | 2 Comments »

Traveler’s Dilemma and Behavioral Economics

Posted by Prashant Hegde on June 6, 2007

Kaushik Basu has devised an interesting game called Traveler’s Dilemma. The problem is stated as below:

Lucy and Pete, returning from a remote Pacific island, find that the airline has damaged the
identical antiques that each had purchased. An airline manager says that he is happy to
compensate them but is handicapped by being clueless about the value of these strange
objects. Simply asking the travelers for the price is hopeless, he figures, for they will inflate it.
Instead he devises a more complicated scheme. He asks each of them to write down the price
of the antique as any dollar integer between 2 and 100 without conferring together. If both
write the same number, he will take that to be the true price, and he will pay each of them that
amount. But if they write different numbers, he will assume that the lower one is the actual
price and that the person writing the higher number is cheating. In that case, he will pay both
of them the lower number along with a bonus and a penalty–the person who wrote the lower
number will get $2 more as a reward for honesty and the one who wrote the higher number
will get $2 less as a punishment. For instance, if Lucy writes 46 and Pete writes 100, Lucy will
get $48 and Pete will get $44.
What numbers will Lucy and Pete write? What number would you write?

According to the game theory – the payoffs for both Lucy and Pete is – ( 2,2). And this is the Nash equilibrium for the problem at hand. Equilibrium happens at (2,2) if you go by the assumptions of classical economics assumptions – people act rationally and people are selfish and act to maximize their gains irrespective of others. Assume Lucy thinks she can make $100 by telling the price as 100. Soon she realizes she can make $101 by telling the price as 99. Realizing the Pete might play the same trick, she decides she will say 98 etc so on so forth till they reach $2 where the equilibrium happens.

Basu says the – the Nash Equilibrium is reached if the game is played rationally and questions the rationality of players in the real-world.

I agree with him in that people get maximum pay off in this game if they acted irrationally. That is how it works in the real-world!. Often(if not always!), people behave irrationally. That is the question behavioral economics tends to question. It has recognized that there are various cognitive biases that are at play when people make choices. And, most often than not these choices are irrational. If you ask me, if the price of the item in question is $42, then in the real-world you will at least get $42 ( or 40?) or more if people are loss averse. However, by applying the second principle, they can maximize their payoff by quoting a value near 100.

Scott Adams, the creator of Dilbert says that people are irrational. They make choices first and then try to rationalize it by giving various reasons. Even psychologists say humans are irrational. Behavioral economics is trying to explain the economic behavior of people in this light…

Posted in Ramblings | Leave a Comment »

Presentations..

Posted by Prashant Hegde on June 2, 2007

I don’t know if this has happened to you, it has certainly happened to me.You are attending a presentation. The speaker is giving you information on a new product or a new technology, or on some system or some marketing information. The presentation is great with lots of charts, tables, pictures etc. The presenter has nicely divided the presentation under various headings each explaining different aspects of the subject. If you are already familiar with the subject, you do not have much problem following it. If the topic is new, you start paying more attention. After few slides, you start feeling little uneasy. You look at others – everyone seems to follow the subject without any problem. So, you hold back yourself from asking questions thinking that others might think you are stupid. As the presenter moves from one aspect to another, you have difficulty in linking them. You try to use your imagination and try to create the linkages between various entities being explained. Then, suddenly, one brave soul starts asking questions to the presenter. Ah..!, you suddenly realize that others are also sailing in the same boat as you. After few more questions, some of the aspects become clear. As you start asking more and more questions, the presenter starts feeling little uneasy because he is running out of time. So, he tells you that he does not have much time left and skims through rest of the presentation. You use your extra-ordinary imagination and try to make sense of the entire presentation. You assume many things that are not explicitly spelled out by the presenter. There is a high probability that your assumptions are wrong!. As one of my managers said, assume means – ASS-U-ME!.

Assume for a moment that you have not seen a car in your entire life. And the presenter is explaining about various parts of the car – the steering, wheels, brakes, accelerator etc. He gives detailed specifications for each of these parts. So, what happens after the presentation is, even though you have understood various parts of the car, you are not sure how the action of the steering is ultimately connected to wheels. How the engine is connected to other parts of the car etc. What is missing from the presentation is – interconnections( i,e relationships ) between different entities.

I should admit here that I have done the same mistake before. We tend to get into details when it is not needed and pay little attention to linking the concepts together.This is especially true if the audience is new to the subject being explained. If you are presenting to management for funding, you need to present detailed data. But, for a general audience these details are unnecessary. I think the key is to remember – find out who the target audience is and present the concept keeping them in mind.

Powered by ScribeFire.

Posted in Ramblings | Leave a Comment »