Citations in Web context now can be machine-readable
Creating a common language for describing in machine-readable form citations in web is the goal of the Protocol for Web Description Resources (POWDER), released by World Wide Web Consortium. By using Powder’s specifications, a Web site can make claims about where information came from and how it can be used. [http://www.technologyreview.com/web/23355/page2/]
Similar approach can be implemented in Content management systems (CMS) and document revision (sub-)systems.
DevReach 2009, Bulgaria
I have attended DevReach’2009: Microsoft technologies at your reach (12-13 October).
Modeling: Here and Now by Chris Sells, Connecting to the Clouds: The Azure Services Platform by Luka Debeljak, From One Web Server to Two: Making the Leap by Richard Campbell, Being Productive with ASP.NET MVC by Hadi Hariri, SQL Server Intelligence by Remi Caron, Fun with Garbage Collection by Ed Musters at the first day of sessions of the conference. And the next day I have attended Practical Parallel Programming with Visual Studio 2010 by Tiberiu Covaci, SOLID Design Principles by Hadi Hariri, Building Data Visualization Applications with WPF by Tim Huckaby, Will It Blend? Building Websites with All Flavors of ASP.NET by Todd Anglin, SharePoint Web Part Development (Deep Dive) by Ed Musters, and The Daily Scrum by Stephen Forte & Remi Caron.
These are my notes listed by sessions:
Modeling: Here and Now There exist types of data models, 3 in count: graph (generally used for programming- behaviour), tree (generally used for transmission- interop), relational (generally used for storage- permanence). Re-factoring DB in VS is a very powerful feauture which requires only the schemas of the DB.
Connecting to the Clouds: The Azure Services Platform The vision of Microsoft was Software + Service which is applied in the Azure Services Platform. The Cloud is an additional platform, a hosted software platform, a shared infrastructure, it is virtualized and dynamic, and you pay as you use it. The Cloud is close to an infinite amount of computer power and is flexible. The Azure Platform consists of blobs, tables, and queus. Blobs is a file system with meta about the files where Web Apps are placed as executables. Tables are DB tables. Queus are tunels for application communication- Service Bus is suppposed to take place here. Nice whitepapers about Azure can be found at davidchappell.com.
From One Web Server to Two: Making the Leap The reason for adding web server is actually reliability. Configurations between web servers must be identical. Single affinity in network configuration refers to sending requests from on visitor IP always to one and the same server in the farm. The letter is important for web sessions saving. Single affinity increases the network traffic by 10%. Google says over 3 sec. for page loading makes you lose visitors.
Being Productive with ASP.NET MVC MVC is about Convention over Configuration assuming certain things. M (the model) is missing in APS.NET MVC, it is replaced by ViewModel and normally 1:1 ViewModel and View relation. One way to implement aspect-oriented programming is by action filters. For complex views (like homepage) the main view calls Controllers to render by pointing where to render their views in the first.
SOLID Design Principles – Single Responsibility Principle: the more we touch, the more bugs can born; A class should have only one reason to change. – Open Closed Principle: A class should be open for extension but closed for change; This is solved by polymorphism, and avoiding switch statements in general. – Liskov Substitution Principle: if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program. – Interface Segregation Principle: the interface is a contract and if you do not implement a function from an interface you are breaking the contract; Clients are supposed to depend on methods that they do not use. – Dependency Inversion Principle: Program to an Interface, not a Class; Use IoC containers. At objectmentor.com are many more principles.
The Daily Scrum In Harvard Business Review before 20 years the idea is first explained that people lose ‘relay race’ if work in issolation. Scrum is an agile process that focuses on communication. Expose problems fundamental to your organization and enable you to fix them earlier. Make small 2 week sprints ending with presenting everything to the client. This way making the client an active member of the team. Separate the basic job types in small things and work on small parts from all types in order to have a solution ready for presentation at the client.
I was able to have talks with a few speakers and present to them my visions which can be found in this blog, too. I have made few friendships with attendees, too. One of the greatest benefits was to meet live with attendees and presenters at the coffee breaks.
Norm Judah, CTO Microsoft Worldwide Services & IT, lecture in Bulgaria
I have attended a lecture of Norm Judah, CTO Microsoft Worldwide Services & IT, in University of Sofia (SU), Bulgaria organized by Microsoft Bulgaria and IT Academy to Faculty of Mathematics and Informatics SU.
All of these are my views according to the notes I have take.
The lecture was titled ‘Computing and Colaboration’ with sub-title ‘The Next Wave’ and was about what we do to plan future products.
Norm have presented the understanding of MS about the 3 SCREENS- TV, mobile phone, PC- and how the users want to do one and the same things on all these screens. 3 Screens and the Cloud slide lists the MS services WindowsLive, XBOXLive, and Zune and explains how content must look the same way on all these screens.
N. Judah have explained to us how avatars in XBOX came as an idea. And have concluded that taking things from how people interact in business and placing them in gaming might be successful.
Therefore, Norm concluded, knowing the intent and personality gives how the user behaves with the system.
We have seen the understanding of MS about extending into the Cloud. A diagram from traditional datacenter, to virtual datacenter, to private cloud, up to public cloud of capacity on demand and global research illustrates this. It challenges Software + Services architecture.
We have watched a movie about MS and Ford product of voice controlled car assistant that can tell you, the driver, where is the nearest coffee bar and how to reach it or which road to take to avoid traffic jams, or to choose music in accordance to the your criteria and so on.
We have got a historical review of the last 20 years. Bill Gates have wrote papers before two decades predicting that we will have information on our fingertips within next decades.
The presentation concluded on the behalf of the video that there are different things to do with the Cloud:
- Move to the Cloud (BPOS, CMS, Live meeting)
- Use the Cloud (Windows Azure, .NET Services, SQL Azure)
- Be the Cloud (SaaS Provider, SOA, ESB)
Microsoft Azure platform contains: Windows Azure, .NET Services, and SQL Azure.
Later we have watched another interesting video ‘A glimpse ahead’ and N. Judah pointed www.officelabs.com address from where we can find other such videos. I have got excited about the timeline of communication taken from the Cloud in the video.
At the end of the presentation we have a few minutes to ask questions. I was not able to ask my questions, but have succeeded to ask a guy from the staff of Judah what I was interested and this is what I receive as an answers.
- About Semantic Web in the Cloud? Tim Berners-Lee have initiated lobbying usage of machine understandable content and services (See Resource Description Framework) back in 2001. MS Research has no video in relation with the letter in Channel 9 MSDN. Term-based and HTML links, and tag-based (wisdom of the crowd) powered search technologies are not context oriented as Semantic web technologies. Do you apply A.I. technologies over semantic web?
- Social networking as a Cloud computing way to coordinate people who are with shared goals? MyBO (my.barackobama.com) have got over a million registered users which with clever coordination practices through the system have helped a lot in making Barack Obama the present President of U.S. In Bulgaria using Facebook technologies of Events and Groups have been organized protests in front of the National Assembly.
1) Microsoft uses the technology of Semantic web but does not share/ publish a lot of schemas. The video that you have watched about MS and Ford car assistant makes many and complex semantic web requests to Bing in order to tell the driver which road to take. We do not do AI, we do voice recognition which I will not call AI. Microsoft does not see semantic web as the next web.
2) Microsoft has a big vision about social networking in the next 10 years. MS have created the advertising system of Facebook. We scan the database of Twitter to see if users have some new features in Bing which is in Beta version for now.
It was an excellent opportunity to see how Microsoft thinks.
Semantic Web
I like the above interview and I have decided to write down the foundations of Semantic web according to it as a struggle to make the first popular.
http://se-radio.net/podcast/2008-11/episode-116-semantic-web-jim-hendler
Software Engineering Radio Episode 116: The Semantic Web with Jim Hendler
We have spent a lot of our times in thinking of very fast ways to explain Semantic web and the best I like is:
Right now, if I have a document, I can put it on the web and instant point to any other document with a simple link. But if I have a database or a spreadsheet I can not put that on the web and have it point another database or spreadsheet.
So, the sense is figuring out what is the database and the infrastructure by which data and definitional information can comes to the web rather than these documents is the heart of the Semantic web.
Web for machines, software, programs:
The key concept is right now the information on the web is primarily described for human inns, but if I am using data or something like that it is very hard to describe that for human use, because what I meant to do is aggregated, collated, queried, all things that pure happen back behind somewhere in the infrastructure, than when I present it to the human it is going to look like a table or a text or a web site, so it is really about building a new infrastructure for the web, to make far more the data work together and of course that will require more machines and machine integration things.
Three things you need:
1. Data format that can include links- If I need to integrate DBs I need someone to knowing what can be merged and what can not be merged, which things link to which other things. RDF is primarily the language that gives you that. So we need a standard for the kind of data description.
2. Means for describing terms of that data- If I have a DB, I look at a column called C27 column 19 and I see that it is filled with the number 15, that doesn’t help me much, if I want a merge with another DB. If I know that that represents the age of a person, then I can find the another DB which have either other properties of that person or other ages of people. Now I know how to put them together. An Ontology or Domain description in a formal way to represent it.
These Ontologies define the meanings of things and here is where the term semantic comes.
If I want to link data together I need to know what is it about, and it is often about something that is not in the DB.
We need to take data out of the database into a place where it can be merged or you need query dynamically the DB.
RDF gives you data in triple stores- graph. If you take two table you can not guarantee that you will get table as a result of merging, if you have two trees I can not guarantee that I will have a tree as a result. Merging graphs always gives you graphs.
Directed labeled graph is RDF.
OWL (higher level data schema) to represent the Ontologies.
3. Standard way to query RDF- SPARQL.
Erik Meijer, Functional Programming, Channel 9 MSDN
These are my notes on Erik Meijer, Functional Programming, C9 MSDN, 2008 technical interview.
Object Oriented Programming is State plus Behavior. Haskell and functional programming are pure languages. Programming languages are classified in useful, pure, and honest. Honesty is when type systems tells you exactly what is going on; types tell you what the system will do. Dynamic programming languages do not mention types and so they are honest, some of them make money. Haskell enables side effects but is honest about them, if you call drinkCaffe function, the cup will be empty after the end of the execution.
Dishonest: int f ();
returns int, but it can read a changing int.
In Haskell: IO <int> f (); declares side effect
In Java signatures specify which exceptions can be thrown, int f (…) throws … ; exceptions in some sense are side effects.
Haskell is pure and honest.
Functional programming
Functional programming is programming using mathematical functions. Popular explanation of functional programming is programming with no side effects, and the letter explanation is wrong.
The same arguments return the same result.
Honest:
int f (int x) {
return x+5;
}
Dishonest- returns different int every time
int f (int x) {
return x + Random();
}
Side effects: Lets remove side effects: Random, Exceptions, Threads, IO. So it is like muted. Up to the extreme it became useless. Early Haskell was the same.
Haskell does:
Argument -> (World -> Result, World)
Argument -> IO Result
I can not copy the world, someone can be observing it. The way you compute is by using IO (reader or write, ot both).
Handling Dependency Injection in C
Martin Fowler, Inversion of Control Containers and the Dependency Injection pattern, 2004 has proposed the concept of Dependency Injection. Despite the fact that Inversion of Control or more accurately termed Dependency Injection is explained in Object-Oriented paradigms (dependencies between classes), I believe that dependency injection can be as well used in non-OO (i.e. C) programs as in OO.
Inversion of Control (IoC) in procedures and functions in procedural programming languages can give big flexibility and re-usability of the code. Handling dependency injection in such a way to propose as few as possible code rewriting in result of updates in a reasonable price of code readability and powerful procedure and function white-box testing. Handling dependency injection will improve Single Responsibility Principle (SRP)-give each function/procedure (class in OOP) just one reason to change; and “Reason to change” == “responsibility”.
Handling dependency injection is proposed here by presenting each and every global variable and function/procedure call in the list of arguments of the concrete function/procedure.
Example (used The Function Pointer Tutorials):
// Pointer to global function. Using TYPEDEF is not a requirement.
typedef int (*ptXFunction) ();
int globalFunc () {
// code ;
}
void func (/* arguments */, ptXFunction globalFunc = &globalFunc) {
// code ;
// calling the global function int globalFunc () through its local function pointer globalFunc
}
Object-Oriented Design Heuristics
60 Design Heuristics
Object-oriented Design Heuristics
By Arthur J. Riel
Classes and Objects: All data should be hidden within its class (Only private attributes; and Not even protected!). Protected methods are allowed. Users of a class must be dependent on its public interface, but a class should not be dependent on its users (Somebody calls my method, and I’m dependent on the other’s behaviour or state). Minimize the number of messages in the protocol of a class (Example: SetMinimumValue(int aValue); SetMaximimumValue(int aValue);, But SetLimits(int minValue, int maxValue)). Implement a minimal public interface which all classes understand (E.g. operations such as copy (deep versus shallow), equality testing, pretty printing, parsing from a ASCII description, etc). Do not put implementation details into the public interface of a class (such as common-code private functions, in Example: Class CBill generates a reference number when the object is created, but not any other time). Do not clutter the public interface of a class with things that users of that class are not able to use or are not interested
in using (Mixture of public and private methods that must be called in a certain order; Methods with parameters, values of which are not available to other classes). Classes should only exhibit nil or export coupling with other classes ( i.e. a class should only use operations in the public interface of another class or have nothing to do with that class; No friends or at least avoid them as much as possible). A class should capture one and only one key abstraction (One simple thing, major responsibility). Keep related data and behavior in one place (Classes methods modify data that belongs to that class). Spin off non-related information into another class (i.e. non-communicating behavior). Be sure the abstraction that you model are classes and not simply the roles objects play (Objects may switch roles runtime; State may indicate role).
Topologies of Object-Oriented Applications: Distribute system intelligence horizontally as uniformly as possible (I.e. the top level classes in a design should share the work uniformly).Do not create god classes/objects in your system (Be very suspicious of an abstraction whose name contains Driver, Manager, System, or Subsystem; Does this name indicate a class that really contains too much responsibilities?). Beware of classes that have many accessor methods defined in their public interface (Many of them imply that related data and behavior are not being kept in one place; Accessor methods access other objects or too much data that is encapsulated in this class). Beware of classes which have too much non-communicating behavior (methods which operate on a proper subset of the data members of a class; God classes often exhibit lots of noncommunicating behavior). Applications which consist of an object oriented model interacting with a user interface (the model should never be dependent on the interface; The interface should be dependent on the model). Model the real world whenever possible (This heuristic is often violated for reasons of system, intelligence distribution, avoidance of god classes, and the keeping of related data and behavior in one place). Eliminate irrelevant classes from your design and Eliminate classes that are outside the system. Do not turn an operation into a class (Be suspicious of any class whose name is a verb or derived from a verb; Especially those which have only one piece of meaningful behavior (i.e. do not count sets, gets, and prints); Ask if that piece of meaningful behavior needs to be migrated to some existing or undiscovered class). Agent classes are often placed in the analysis model of an application (During design time, many agents are found to be irrelevant and should be removed).
The Relationships Between Classes and Objects: Minimize the number of classes with which another class collaborates (The less connections the better; E.g. Facade design pattern). Minimize the number of message sends between a class and its collaborator (By defining fewer methods, for example). Minimize the amount of collaboration between a class and its collaborator (I.e. the number of different messages sent). Minimize fanout in a class (I.e. the product of the number of messages defined by the class and the messages they send). If a class contains objects of another class (then the containing class should be sending messages to the contained objects, i.e. the containment relationship should always imply a uses relationship). Most of the methods defined on a class should be using most of the data members most of the time. Classes should not contain more objects than a developer can fit in his or her short term memory (A favorite value for this number is six). Distribute system intelligence vertically down narrow and deep containment hierarchies. When implementing semantic constraints (It is best to implement them in terms of the class definition; Often this will lead to increasing number of classes in which case the constraint must be implemented in the behavior of the class, usually, but not necessarily, in the constructor). When implementing semantic constraints in the constructor of a class (place the constraint test in the constructor as far down a containment hierarchy as the domain allows). The semantic information on which a constraint is based (is best placed in a central third -party object when that information is volatile). The semantic information on which a constraint is based (is best decentralized among the classes involved in the constraint when that information is stable). A class must know what it contains, but it should never know who contains it (Some design patterns break this rule, for example, Chain of Responsibility (used often with Composite)). Objects which share lexical scope (i.e. those contained in the same containing class; should not have uses relationships between them).
The Inheritance Relationship: Inheritance should only be used to model a specialization hierarchy. Derived classes must have knowledge of their base class by definition (but base classes should not know anything about their derived classes; State pattern). All data in a base class should be private (i.e. do not use protected data). Theoretically, inheritance hierarchies should be deep, i.e. the deeper the better; Pragmatically, inheritance hierarchies should be no deeper than an average person can keep in their short term memory (A popular value for this depth is six). All abstract classes must be base classes; All base classes should be abstract classes. Factor the commonality (of data behavior, and/or interface); as high as possible in the inheritance hierarchy. If two or more classes only share common data (no common behavior) (then that common data should be placed in a class which will be contained by each sharing class). If two or more classes have common data and behavior (i.e. methods) (then those classes should each inherit from a common base class which captures those data and methods). If two or more classes only share common interface (i.e. messages, not methods) (then they should inherit from a common base class only if they will be used polymorphically). Explicit case analysis on the type of an object is usually an error (the designer should use polymorphism in most of these cases). Explicit case analysis on the value of an attribute is often an error (The class should be decomposed into an inheritance hierarchy where each value of the attribute is transformed into a derived class). Do not model the dynamic semantics of a class through the use of the inheritance relationship (An attempt to model dynamic semantics with a static semantic relationship will lead to a toggling of types at runtime). Do not turn objects of a class into derived classes of the class (Be very suspicious of any derived class for which there is only one instance). If you think you need to create new classes at runtime (take a step back and realize that what you are trying to create are objects; Now generalize these objects into a class). It should be illegal for a derived class to override a base class method with a NOP method (no-operation), I.e. a method which does nothing. Do not confuse optional containment with the need for inheritance (modelling optional containment with inheritance will lead to increasing number of classes). When building an inheritance hierarchy (try to construct reusable frameworks rather than reusable components).
Multiple Inheritance: If you have an example of multiple inheritance in your design (assume you have made a mistake and prove otherwise). Whenever there is inheritance in an object-oriented design ask yourself two questions 1) Am I a special type of the thing I’m inheriting from? And 2) Is the thing I’m inheriting from part of me?. Whenever you have found a multiple inheritance relationship in a objectoriented design (be sure that no base class is actually a derived class of another base class, i.e. accidental multiple inheritance).
The Association Relationship: When given a choice in an objectoriented design between a containment relationship and an association relationship, choose the containment relationship.
Class Specific Data and Behavior: Do not use global data or functions to perform bookkeeping information on the objects of a class (class variables or methods should be used instead).
Physical Object-Oriented Design: Object-oriented designers should never allow physical design criteria to corrupt their logical designs (However, very often physical design criteria is used in the decision making process at logical design time). Do not change the state of an object without going through its public interface (No public/protected data members, No friends).
Lecture on Design Patterns, Refactoring, Sane Principles to make you a better developer by Dino Esposito
Dino Esposito in May 14, 2009 have presented a lecture on Design Patterns, Refactoring and Sane Principles in Days of Microsoft’2009 in Faculty of Mathematics and Informatics, University of Sofia, Bulgaria, which I have attended.
These are my notes from the lecture:
Bad software design… deterioration in design. Bad software is hard to maintain and evolve. Complete redesign may not be an option. STOP at the first sign of deterioration.
Foundation of Software Design- Structured design (high cohesion; low coupling); and Separation of Concerns (modularity; information hiding). ClassA and ClassB are cohesive when changes to A have no repercussion on B. The problem is in the hidden dependencies, not in the public explicit (cohesion) dependencies.
Single Responsibility Principle (SRP)- give each class just one reason to change; and “Reason to change” == “responsibility”. In example: Invoice class does not have a responsibility to print itself.
Coupling: Level of dependency between 2 modules. ModuleA and ModuleB are coupled when changes to A force you to make changes on B.
Achieve stable constructed interfaces. ModuleA does not need to know internals of B.
Separation of Concerns (since 1974). Concern == feature of system. Taking care of each of the concerns: for each one concern, other concerns are irrelevant. Hiding implementation of behavior.
Object Oriented Design: 1st principle- Find pertinent object; 2nd principle- Program to an interface.
OOD is one paradigm. Nouns in requirements document are best candidates for classes, verbs- for functions (methods in classes).
Difference between inheritance and composition: inheritance enables polymorphism in parralel to composition, in general.
Advanced principles: 1) Open/Close; 2) Substitution; 3) Dependency Inversion. Open/Close- open for extension, close for modification; Substitution- subclasses should be substitutable for their base classes; Dependency Inversion- Low-level modules injected into the high-level module (not invoked by). Thus inverting the control of flow. Various patterns: dependency injection; service locator.
Dino Esposito (http://weblogs.asp.net/despos/) is Microsoft Most Valuable Professional and is one of the world’s authorities on Web technology and software architecture. He writes articles covering topics such as AJAX, Silveright, software design and patterns. The event was sponsored by Kulov.net, Musala Soft, Microsoft and Faculty of Mathematics and Inforamtics, University of Sofia, Bulgaria. The lecture was Chapter 3 of his book Microsoft® .NET: Architecting Applications for the Enterprise (PRO-Developer).