Tuesday, March 29, 2011

Why go green?

This is an article that I wrote some time back for a well known Pakistani internet magazine, about green computing.

This answers following questions:
  • What is Green Computing?
  • Why go green?
  • Who is going green?

They say about Nature, the more the need is, the abundant is its quantity. Air is one of such instances.

So, what is it?
To answer the question, it is a "way" to minimize the environmental pollution. But how would a computer harm the environment? You may ask. Well, how did you last dispose off your old 286 desktop pc along with a large 14 inch Cathode Ray Tube (CRT) monitor? I ask.

You will either throw it, sell it to *raddi wala* for as low as 50 rupees, or give it away to your house maid who would "eventually" do the same thing as you did.

And you might well find some garbage collector lads burning your monitor in the chilly mornings to warm their hands.

Have you ever thought about how this pc ends up, and is processed by the Nitrogen Cycle?

Severely dangerous gas is released when the plastic, silicon, mercury, etc is burnt; and to my surprise, some time back when I tried to burn my much fiddled/diddled oldest Cathode Ray Tube (CRT) computer monitor back in 1998, burns with a notable blast - reason being, some parts in the circuitry (specially capacitors) can hold high voltage of charges even when the component is turned off.

Now think about this; you are in-charge of computer labs in a large company having tens of labs equipped with several hundreds of computers and hardware equipments. To maintain a certain level of quality your management decided that you need to replace all; they mean ALL of your hardware with brand new machines.

It may be easy for you to procure another couple of hundred pcs; but How, and where will you dispose off the existing ones?

Try answering this question and you might understand.

Even if you are able to find an online, offshored, Garbage collector; you've only "transferred" the direction of responsibility in question. But really, how do you think that Garbage collector will dispose off the crap. In case if you are thinking that the Garbage collector is going to reuse the workable components - there are three things that you must know:

1. Old components, especially in computing industry, are just worthless from every aspect, selling or reusing. Or downgrade drastically.

2. You may want to recycle those components, but remember not everything can be recycled; you must "produce" recycle'able components in order for them to be recycled.

3. For the sake of making the point, let’s assume that "you must dispose" the hardware.

Some believe that it is better to have passed on your computer to benefit someone else - this helps others.

This avoids the environmental dangers of disposal in landfill or incinerators. But this "could" have been correct if the components could retain its original state of functionality. Many charities have recently imposed minimum system requirements for donated equipment.

So, you might end up digging a hole somewhere near Gavadar so that no one would know. That’s exactly where the Green Computing comes in; it would stop you from doing so.

A Malaysian Multimedia University professor, Dr San Murugesan, in his recent publication 'Harnessing Green IT: Principles and Practices', defines green computing as:
"The study and practice of designing, manufacturing, using, and disposing of computers, servers, and associated subsystems—such as monitors, printers, storage devices, and networking and communications systems—efficiently and effectively with minimal or no impact on the environment."

Who is doing what?
Companies are now producing environment friendly components; even with an extra extensible life cycle or those that could be disposed off easily.

In Pakistan, the concept is relatively "still" new. There are a few technology companies who helped. Students of Karachi University, SZABIST are exploring the idea in their research projects.

A joint venture of Lahore based software house FiveRivers Technologies, and ClearCube Technology provides extensive virtualization services. In India green computing is becoming more prevalent[2], WIPRO was the first company to go green in 2007. Bangladesh is already in the lines and trying to introduce the idea.
PCAdvisor ran a poll[5], that resulted in that, 45% of firms have green computing policy in UK.

Recently people have started adding, you might have noticed, a green colored tree-and-road icon in the footer of email messages, discouraging the printing of email text unless necessary. That is a part of green computing concept.

Several international certification(CompTIA Strata Green IT, for instance) programs have been introduced for managers, which show that they have good knowledge of green IT practices and methods and why it is important to incorporate them into an organization.

According to Microsoft Research Labs the best practices [6] for sustainable architecture design includes:
• Reduced energy consumption
• Reduced operational costs for the data center and business
• Understand energy consumption and environmental impact.
• Build environmental sustainability into change and configuration management processes.

This is where Cloud Computing plays an important part, where environment (including hardware, operating system, etc) is provided by the service (Virtualization, etc) provider; all you have to focus on is business. Cloud Computing was ranked top technology strategy by Gartner[3] for year 2010.

There are quite a couple of companies providing virtualization services in Pakistan; and whole lot more in India.

Government can play a vital role, by introducing laws and regulations to dispose such components. Govt can encourage garbage collector companies to get an international quality certification for waste disposal.
Provide help line 0800 numbers for public and corporate consumers so that they feel encouraged and comfortable disposing off the material.

How can I help?
Just remember the primary goal:
  • Discourage the make/use of hazardous components, and factory waste.
  • Encourage the make/use of efficient, energy-aware, durable, recyclable components.

If you are "just a guy" living next door, then don’t throw away the pc or hand it over to "help" someone - well just wait - wait till Mustafa Kamal installs the promised Waste Disposal and Management System.
Just so this may interest you, you better wipe your hard drive clean before disposing off - your data can be restored[4].


Peek More At:
• Going Green [http://www.time.com/time/goinggreen]
• Harnessing Green IT: Principles and Practices [http://www.computer.org/portal/web/csdl/doi/10.1109/MITP.2008.10]
• Green Computing [http://www.computing.co.uk/ctg/special/1814241/green-computing]
• Old Computer Disposal [http://www.intel.com/learn/practical-advice/computer-maintenance/green/old-computer-disposal]
• http://en.wikipedia.org/wiki/Green_computing

References:
[1]: http://jehanara.wordpress.com/2009/08/25/pakistan-tech-sector-helping-companies-to-go-green
[2]: http://www.businessweek.com/globalbiz/content/apr2009/gb20090413_237615.htm
[3]: http://www.gartner.com/it/page.jsp?id=1210613
[4]: http://www.which.co.uk/news/2009/01/smash-up-your-hard-drive-to-avoid-id-theft-166079/
[5]: http://www.pcadvisor.co.uk/news/index.cfm?newsId=3247127
[6]: Microsoft Research Labs [http://research.microsoft.com/pubs/78813/AJ18_EN.pdf]

Friday, March 25, 2011

Find trailing zeros in a factorial number

How many zeros are at the end of "1000!" (one thousand factorial)?

No cheating... calculator is not allowed! Btw, you cant calculate that, because of the

I hope you are not thinking about multiplying all the numbers, are you?

N! = N x (N-1)!

The trick is around the the number Five(5).

STEP 1: Divide the number by 5, and note down the remainder
STEP 2: If the remainder is greater than 5, goto step 1
STEP 3: Add all remainders

Yep, thats it.

Lets have an example.

Example 1: 6!
=> 6/5 = 1 (This means, expect one (1) trailing zero at the end of 6!)

Example 2: 10!

10/5 = 2 (Expect two zeros)

Example 3: 50!

50/5 = 10
10/5 = 2
=> 10 + 2= 12 (Expect 12 trailing zeros)

Example 4: 100!

100/5 = 20
20/5 = 4
=> 20+4 (Expect 24 zeros)

I am leaving 1000! as an exercise for the reader (0:

Btw, no standard C data type can handle numbers this large. Unless you use some Mathlab library or your own code with some arbitrary data type restricted only to the available memory, you might be able to write a program. So, just find out the number of trailing zeros; and if you want to validate the answer using Calculator, try for 15!, 25!, 35!, etc...

Enjoy!

Wednesday, March 23, 2011

C++ Refresher Course - Interview Questions and Answers

Refresh your C++ days! This resource is not only an excellent resource to interview questions, I found the answers interesting enough to float your thoughts upon. Compiled by Dr. Fatih Kocan, Wael Kdouh, and Kathryn Patterson. Though, I am not sure how long this PDF is going to stay there.

My first love "was" and "is" C++ - just that I have been unable to spend time with it since I switched to .NET development stack. The world of dots. While rest of the class was moving into the Java and qualifying for the certifications of UML, the challenge of understanding C++ attracted me more into it. Luckily I got a chance to learn more about C++ from a university senior, now in Microsoft, Haroon Ahmed. He was the inspiration that I wrote multilingual chat server in plain VC++ and made it to the AQ Khan Research Labs, an state level software development competition.

In .NET, the emphasis is more on business, than the mere UI library that you had to create before developing your logic. Or everytime you start your Doc-View architected C++ application, you had to provide everything that would make your business logic work. And then move to business logic. More side-kick code was required to develop an app. And in .NET, seldom - very seldom, we find ourselves implementing the OnPaint, OnDraw, people do not know about the PreTranslateMessage(), yep I'm talking about VC++, WNDPROC, the DispatchMessage method. The power that VC++ brought with it - Absolute - the God Language.

Plus, the concept of CLR; the .NET exe and dll aren't really exe/dll. They are just the intermediate language for the CLR that would JIT the .EXE/DLL and turn that into machine language. How easy it is to disassemble your code! that hurts. (0:

Just so this may interests you, when a managed module is invoked, the OS(windows) "thinks" that its just another "normal"(win32) executable; then it tells the windows loader to load the file; the loader reads the idata section, and when it finds the reference of mscoree.dll, it knows that it now needs to load the managed module in CLR; and then eventually managed module's IL is JIT'ted(Just in time compilation) into native code; which means, MSCorEE.dll compiles IL to native CPU instructions. I wrote about it sometime ago.

But still, if you are to develop a mission critical system, or software that does some real time process, or rendering realtime data, with zero delays, and zero compromise on performance - C++ is the way to go.

Well, also, if you want more, for instance to know about STL, ATL, COM, DCOM development using VC++, check out the CODEGURU.com website. It has excellent, invaluable resources in their VC++ section.

Wednesday, March 16, 2011

How to get checked values out of a CheckBoxList?

Have you ever thought of why exactly do you love custom extensions? Roll out one just for this case:

public static class ControlExtensions
{
    public static string GetCheckedValues(this CheckBoxList list)
    {
        return String.Join(",", list.Items.OfType()
                                             .Where(s => s.Selected)
                                             .Select(s => s.Value).ToArray());
    }

}



Usage example, somewhere in ASP.NET MVC:

public ActionResult Index()
{
    CheckBoxList lst = new CheckBoxList();
    lst.Items.Add(new ListItem("one", "1"));
    lst.Items.Add(new ListItem("two", "2"));
    lst.Items.Add(new ListItem("three", "3"));
    lst.Items.Add(new ListItem("four", "4"));

    lst.Items[0].Selected = true;
    lst.Items[1].Selected = true;

    ViewData["Message"] = lst.GetCheckedValues();// Here.

    return View();
}

Enjoy!

Sunday, March 13, 2011

Top 10 answers to top 10 software requirements interview question

This is a second post to the sequel to Jurgen Appelo’s blog post, where he asks top 100 questions that a software developer should know.

1. Can you name a number of non-functional (or quality) requirements?

Anything that is not a direct requirement by the buyer.

For instance, a buyer wants a software that periodically uploads an xml file to an FTP from a local directory. A functional requirement here is that system shall display a user interface that lists the files that have been transferred with date/time stamps and other information.

But "how frequent" the software should upload the file, is non functional requirement.

Similarly, the audit log modules that you write, and that “well known” archival windows service is a part of non functional requirement.

The file to interact with the software and configure; that is, provide the folder path/location and xml files with valid format.

Other non functional requirements, but not limited to, are Usability, that is user interactions with a system. How many times your customer will need to train the user? How complex is your user interface? What are you doing about drop down lists with more than 500+ items in it? Do you really expect your user to scroll down to 270th item using the mouse? (0;

Think about it.

What do you do? Provide the drop down list – as is? Provide a popup to find and select from? Or just provide a text box with “Find” button? Obviously, there the answer varies from situation to situation; But remember, anything that is interactive, intuitive for the user – is the best way to keep your user happy.
How about Security? Remember the SSO’s you have been integrating in all your web apps? Security is another non functional requirement.

Performance (response time?), reliability (this may boil down to the service level agreements/support – MTTR, MTBF, etc), maintainability (life cycle costing), efficiency (memory consumption, leakages?), are a few such examples of non functional requirements.

2. What is your advice when a customer wants high performance, high usability and high security?
Beware! The question is a fully loaded. I’ll KISS it according to the knowledge that I have (0:

High performance: is a broad term.

High performance computing, high performance storage system, high performance chassis (read: hardware specs); depending upon what exactly a buyer wants, your suggestion could be around the lines of: clustering, load balancing, mirroring, replication, fail over, segmentation; implementing RAID levels (for instance level 5 – being highest), SAM hardware, in-memory databases, etc.

If talking about high performance programming technology, go for using C++; this provides close to real time processing.

High usability:
This means, ease of use. Allow user to use their intuition about how software will work or react to a user action.

Hire experienced user experience designers and have them research and come up with the best UI’s ever. What are you going to use most of the screen to display main content? How will you display menus and sidebars? Should they take up less space than the main content? How about when the screen goes to 800x600 from 1024 x 768? How your application will react to a range of internet browsers? Etc...

Conduct closely interacted rad/jad sessions with the customer; using iterative releases; fix font, color schemes, menus, bread-crumbs, action buttons, long lists, etc. Save your users from being POLArized.

Note that, the usability aspect is not only for software – it applies everywhere. Thinking about a mobile phone that has no button and you don’t know how to turn in on. Or a school bag that is a zipper inside out.
High Security:
Depends upon the scenario and specific security requirements; if its non-repudiation security can be provided using SSL/transport level security, Client Certificates, PKI, TDES.

Use a combination of cryptographic techniques, for instance, symmetric, asymmetric, and hashing algorithms – wherever whichever is applicable.

Provide a solution of infrastructure that includes demilitarized zone (DMZ), encrypted transportation of data, fire walls, secure gateways, etc.


If from coding perspective, obfuscate your code; for instance .NET is almost an open source; so you will need to obfuscate your code in order to make it less prone to hack. Or use low level coding to keep the code to low level.

Use a centralized security mechanism, for instance providing SSO for centralized authentication; encrypted data sources, etc.

3. Can you name a number of different techniques for specifying requirements? What works best in which case?

Brainstorming, Focus Groups, Interface Analysis, Interview, Prototyping, Requirements Workshop, Reverse Engineering, Survey, etc.

4. What is a requirement tracing? What is backward tracing vs. forward tracing?
Requirements tracing.



5. Which tools do you like to use for keeping track of requirements?

There could be several ways to keep track of requirements. Make a software requirements specifications document to list all of the requirements and description.

Prepare an excel sheet the list down the requirement, type, priority, dependency, etc.
Matt Light, Research VP, Gartner says:
“Requirements management can be simplified if initial requirements definitions are captured in a database-based tool to enable collaborative review... traceability and versioning/change control”.

Whatever you choose to maintain the list of the requirements, don’t forget the add that in your version control system.

I love Subversion(+ TortoiseSvn + AnkhSvn )

Cvs is ok.

Git is absolute.

6. How do you treat changing requirements? Are they good or bad? Why?

Change denotes life. No change means – stagnant or dead. Therefore change is an essential part of “life” and of course software industry.

Good or bad? Depends upon the sort of change.

A change in decision by buyer to shut down the project may not be a good change for the seller. A change to add three more buildings in a residential complex may be a good change for the seller.

How about the change, when a project, half way through using Oracle WebCenter as a base technology is decided to move to Microsoft Office SharePoint Server 2010?
Generally there is an Issue Control List(usually a Microsoft Excel Sheet?) also called Customer Issues and Changes List (CICL), containing date/time, request issuer, type of change(change request, bug, fix, etc), priority, description, remarks, and the status of the issue.

7. How do you search and find requirements? What are possible sources?
Stakeholders.

User, customer, developer, manager, sponsor, functional manager, business, technology departments, etc.

Note that even those shall be called stakeholders, who would “not” benefit from the project. How so? Because they “can” influence the management induce/reduce the scope of work or kill the project completely. For instance, you plan to install a payroll system in a bank; the bank personnel has been working in the administration departments for years (lets say 20+ years); and they “think” that after the installation of an electronic solution, company might decide to lay them off and keep only two or three employees. So, they might try any or all of the actions to shut this project down. In this case, these department personnel are one of the key stake holders to keep an eye on.

Possible sources of finding requirements, besides stakeholders are, company’s historical records that may contain the experiences of similar projects, market research, etc.

8. How do you prioritize requirements? Do you know different techniques?

Requirement prioritization is a process of formalizing and shifting focus on specific requirements. This includes gaining customer buy-in on prioritized requirements.

Agile development methodologies takes into account the requirement prioritization; you prioritize, select the requirements that you want to rollout for this iteration, validate and release the your software.

You will have to define some scale of prioritization based upon customer feedback. For instance, a customer may say that they want certain functionality first, and then they can come back on the user interface afterwards.

Here is a nice to read article, in case if you want to dig further.

Classical (stakeholders do the prioritization), Exhaustive (all areas including minor ones), and Value Based (prioritization based upon ROI) are a few prioritization techniques.

9. Can you name the responsibilities of the user, the customer and the developer in the requirements process?

A simple responsibility assignment matrix can help. A list that contains and rest of the columns may contain the role name. For instance:
Role A: Project Sponsor
Role B: Project Manager
Role C: Business Analyst
Role D: System Analyst
Role E: Technical Architect
Role F: Programmer
Role N: Whatever that needs to be here

 
10. What do you do with requirements that are incomplete or incomprehensible?

This is a fairly subjective topic to be covered in a “definition”.

Generally, with incomplete or incomprehensible requirements, rolling-wave planning project management technique can be used; which emphasizes on focusing on small areas of requirement until further scope of requirement gets clearer.

Use requirements gathering techniques to gather as much information as possible.
But in cases where requirement is “incomplete or incomprehensible”, use Assumptions. Yep! Do not stop the work, make assumptions, let customers know about the assumptions you made in black and white, and move forward. In this case, Agile methodology will help.

STEP 1: Add/refine requirements + Assumptions
STEP 2: Build
STEP 3: Verify
STEP 4: Release/rollout
STEP 5: Iterate (Goto step 3)
STEP 6: Increment (Goto step 1)

I have found this small article to be very interesting and useful, especially if you do design the requirements or functional specifications documents.

Wednesday, March 2, 2011

Should I ever use Entity Framework 4.0?

I did a small in-house presentation for the young architects in our company and though of sharing my findings. We compared different ORMs, and discussed more about entity framework vs NHibernate vs performance that ADO.NET provides. I will also post the difference of performance that we found while comparing NHibernate and ADO.NET. You count this in continuum to my previous post that I wrote sometime back, about EF4: ADO.NET Entity Framework v4.0

What is Entity Framework?


  • Is a data access framework comes with .NET 4.0
  • Bridges the gap between database and objects(POCO)
  • Its an evolution of ADO.NET
  • Uses Entity SQL (eSQL) – Query to entity framework model (.edmx files)
  • Sits on top of ADO.NET 2.0
  • Has an out-the-box answer with regard to n-tier development, in "self-tracking entities“ - eventually.
Architecture
ado.net evolution
FIG 1: ADO.NET Evolution and technology support

entity framework arch
FIG 2: Entity Framework mapping to ADO.NET

entity framework layer
FIG 3: Entity Framework components

Provides three types of approach:
  • Database first (the old way – then generate the model, then code)
  • Model first (the .edmx model – and then generate the database)
  • Code first (and then generate the model, and then the database)
What does it provide?
  • Generates strongly-typed entity objects
  • Customizable beyond 1-1 map
  • Generates mapping/plumbing code
  • Translates LINQ queries to database queries (LINQ to Entities)
  • Materializes objects from db calls
  • Tracks changes, generates updates/inserts
  • Giving intellisense, compile-time and debugger support
Where can it help?
  • Create ER-->Database
  • Generate ER Model
  • Quickly provide the CRUD operations, along with lazy/eager loading options.
  • Data layer (Enumerated tables, query generation, default crud, complex joins - reports, data core Wrapper, business logic, etc?) – You may want to utilize the Unit of Work pattern along with the Repository pattern.
  • Specific modules (UI logic - Handling data/complex grids, cells within cells)
Are there any EF data providers?
  • The Progress DataDirect 100% managed code ADO.NET data provider eliminates the need for database clients, which boosts .NET application performance and delivers a flexible, secure connection to all major databases, including Oracle, DB2, Sybase, and Microsoft SQL Server.
  • VistaDB is the only .NET embedded database that allows you to Xcopy a single DLL for both 32 and 64 bit runtime support.
  • Devart, offers ADO.NET Data Providers supporting access to Oracle, MySQL, SQL Lite, PostgreSQL, and Microsoft SQL Server databases.
  • OpenLink's Virtuoso ADO.NET Data Provider allows developers to access native Virtuoso data (SQL, XML, and RDF) and any Virtuoso Linked Tables from external ODBC and JDBC accessible data sources. Known-compatible external data sources include Oracle (versions 7.x to 11.x), Microsoft SQL Server (6.x to 2005), IBM DB2 , Sybase (4.2 to 12.x+), IBM Informix (5.x to 11.x), Ingres (6.4 to 9.x), Progress (7.x to 10.x), MySQL, PostgreSQL, and Firebird.
  • IBM supplies ADO.NET data providers for access to DB2, Informix, and U2 databases.
  • Sybase SQL Anywhere 11 includes Sybase iAnywhere's ADO.NET Data Provider.
  • Sample Entity Framework Provider for Oracle - community effort project
Some points to ponder
  • Primary purpose is providing basic CRUD operations
  • Not really feasible for reporting.
    • eSQL Learning Curve, usually required to learn eSQL(unless generating complex reports?).
    • Requires knowledge of eSQL for complex joins/GROUPBY
    • Uses traditional string based queries with a more familiar SQL like syntax
    • Dynamic queries may be composed in a traditional way at run time using string manipulation
    • Projection is not possible; you must always return an ObjectQuery<T>
  • Develop against a conceptual view(the model, that is, .edmx classes) of your underlying data, not the store itself
  • Doesn't have a lot of providers for other databases.
  • Very young
  • Small community behind it.
  • Requires workaround for LEFT OUTER JOINs. For instance, see following loc:
   1: var v = from en in context.Entity.Include("PostalAddress").Include("PostalAddressType")
   2:  
   3: let leftouter = (from pa in en.PostalAddress
   4:                 select new //Project into a new object
   5:                 {
   6:                 PA = pa,
   7:                 PAT = pa.PostalAddressType
   8:                 }).FirstOrDefault()
   9:                 
  10:             select new {
  11:             EntityID = en.EntityID,
  12:             PostalAddressID = (Guid?)leftouter.PA.PostalAddressID,
  13:             PostalTypeID = (Guid?)leftouter.PAT.PostalAddressTypeID
  14:             };
 Entity Framework problems with SQL IN keyword
…AND D.STATE_NAME IN ('Approved', 'Scanned', 'Returned') is invalid!    
eSQL is not SQL!
  • Cannot access multiple database! Quite rare in our case…
Relationship navigation problem – Learn to navigate!
NAVIGATE operator allows a query to explicitly traverse a relationship; says don’t use joins.
   1: SELECT SalesPersonID, FirstName, LastName, HireDate
   2: FROM SalesPerson sp
   3:     INNER JOIN Employee e ON sp.SalesPersonID = e.EmployeeID
   4:     INNER JOIN Contact c ON e.EmployeeID = c.ContactID
   5:     INNER JOIN SalesOrder o ON sp.SalesPersonID = o.SalesPersonID
   6: WHERE e.SalariedFlag = 1 AND o.TotalDue > 200000
The above code is like following is eSQL:
   1: SELECT VALUE sp
   2:     FROM AdventureWorks.AdventureWorksDB.SalesPeople AS sp
   3: WHERE EXISTS(
   4:     SELECT VALUE o 
   5:         FROM NAVIGATE(p, AdventureWorks.SalesPerson_Order) AS o
   6:     WHERE o.TotalDue > 200000)

 What about EF Logging? Does it provide cool logging features?
Nope. Missing!

Use objectQuery.ToTraceString(); for query logging; yep, thats all.

Output for the above loc: Untraceable!
[SELECT 1 AS [C1], [Extent1].[CHEQUE_ID] AS [CHEQUE_ID], [Extent1].[CHEQUE_NUMBER] AS [CHEQUE_NUMBER], [Extent1].[ACCOUNT_NUMBER] AS [ACCOUNT_NUMBER], [Extent1].[ACCOUNT_TITLE] AS [ACCOUNT_TITLE], [Extent1].[MICR_AMOUNT] AS [MICR_AMOUNT] FROM [dbo].[CHEQUE] AS [Extent1] INNER JOIN [dbo].[CHEQUE_ACTIVITY] AS [Extent2] ON EXISTS (SELECT cast(1 as bit) AS [C1] FROM ( SELECT cast(1 as bit) AS X ) AS [SingleRowTable1] INNER JOIN [dbo].[CPS_CHEQUE] AS [Extent3] ON 1 = 1 WHERE ([Extent2].[CHEQUE_ID] = [Extent3].[CHEQUE_ID]) AND ([Extent1].[CHEQUE_ID] = [Extent3].[CHEQUE_ID]) ) INNER JOIN [dbo].[SEC_USER] AS [Extent4] ON EXISTS (SELECT cast(1 as bit) AS [C1] FROM ( SELECT cast(1 as bit) AS X ) AS [SingleRowTable2] INNER JOIN [dbo].[USER] AS [Extent5] ON 1 = 1 WHERE ([Extent2].[USER_ID] = [Extent5].[USER_ID]) AND ([Extent4].[USER_ID] = [Extent5].[USER_ID]) ) INNER JOIN [dbo].[WF_STATE] AS [Extent6] ON ([Extent1].[STATE_ID] = [Extent6].[STATE_ID]) AND (([Extent6].[STATE_NAME] = 'Approved') OR ([Extent6].[STATE_NAME] = 'Scanned') OR ([Extent6].[STATE_NAME] = 'Returned'))]
How in the world will you map Extent1 with the actual database table? think, and leme know.

Vote of no/confidence?
Here is a website, expecting “more” from Microsoft! (0: Signed by the people who doesn’t buy into the vote of confidence on this product. What does this mean? This means, no one, at least no one from the signatories.

So, should I ever use entity framework?
Yes, you should.

B…ut… Why?
Community as well as the online help (tutorials, videos, etc) growing, stabilizing, and expanding fast. Plus, dont forget the LINQ functionalities. EF has the best LINQ providers as compared the NHibernate. NHibernate is far far beyond where LINQ is concerned.

Where should I use it?
Anywhere and everywhere. Except for your production environment! If you still are, then tell your customer to be prepared for surprises. Since EF is growing faster, you may bank upon it after sometime.
Good luck.

References:
Disclaimer: Please understand, the motive behind this post is to understand the pros and cons, this means, there is NO boiler plate answer; and its up to the reader to decide whether they want to use EF or not.

    Related Posts

    Popular Posts