Categories

Friday, August 28, 2015

C# is the most used programming language at work

0825.sdt-poll
C# is making its way past Java as the most popular programming language in the workplace, according to SD Times readers.
While Java sits on top of the TIOBE Programming Community index for August 2015, with C# coming in at No. 4, our latest poll shows C# is the No. 1 language used in the workplace, with Java and C/C++ following.
Out of 1,166 votes, 37% of developers voted for C#, 20% voted for Java, and 17% voted for C/C++. The least-popular programming languages used at work, according to the poll, included Python/Ruby/Perl and Objective-C/Swift.
A more detailed breakdown of the poll results is available below:
0825.sdt-poll-poll

Source: http://sdtimes.com/sd-times-blog-c-is-the-most-used-programming-language-at-work/

Thursday, August 27, 2015

LINQ To SQL Vs Entity Framework

Entity Framework is ORM(Object Relational Mapping) introduced by Microsoft. It proves very useful for new developers for it’s simplicity to query against conceptual schema and also has rich feature set. Many time the question has been asked in the interview to explain differences between Entity Framework and LINQ To SQL to the developers who has work experience in Entity Framework. I have made table of differences between these two technologies.

Parameter LINQ To SQL Entity Framework
DB Server LINQ To SQL supports only Microsoft SQL Server 2000 and later version and even SQL Server 2000 has some limitations. With Entity Framework you can plug any DB Server i.e. IBM DB2, Sybase SqlAnyWhere, Oracle, SQL Azure, and lot more.
Inheritance In LINQ To SQL inheritance is difficult to apply. It supports Table Per Class Hierarchy(TPH). In Entity Framework inheritance is simple to apply. It supports Table Per Class Hierarchy(TPH) and Table Per Type(TPT). It also provides limited support of Table Per Concrete Class(TPC).
Complex Type(Non scalar property of an entity type that does not have a key property) Support LINQ To SQL does not support the creation of complex types. Entity Framework support the creation of complex types.
Complexity LINQ To SQL is easier to use. Entity Framework is more complex compared to LINQ To SQL.
Model LINQ To SQL provides one-to-one mapping of tables to classes. Entity Framework enable decoupling DB Server(Database Schema) and Entity Representaion in terms of Model(Conceptual Schema). You can map one table to multiple entities or multiple table to one entity.
Development Time LINQ To SQL is simple to learn and implement for Rapid Application Development, but it will not work in complex applications. Entity Framework has more features which will take time to learn and implement, but it will work in complex applications.
Mapping Type In LINQ To SQL each table is mapped to single class. Join table must be represented as a class. Also, complex types cannot be easily represented without creating separate table. In Entity Framework a class can map to multiple tables.
File Type It uses Database Markup Language(DBML) file that contains XML mappings of entities to tables. Entity Framework uses four files EDMX, CSDL, SSDL and MSL. The later three are generated at runtime.
Query Capability LINQ To SQL has DataContext object through which we can query the database. With the Entity Framework, we can query database using LINQ To Entities through the ObjectContext object and ESQL(provides SQL like query language). In addition, Entity Framework has ObjectQuery class(used with Object Services for dynamically constructing queries at runtime) and EntityClient provider(runs query against conceptual model).
Performance LINQ To SQL is slow for the first time run. After first run provides acceptable performance. Entity Framework is also slow for the first run, but after first run provides slightly better performance compared to LINQ To SQL.
Future Enhancement Microsoft intended to obsolete LINQ To SQL after the Entity Framework releases. So it will not receive any future enhancements. Entity Framework has future enhacements.
Generate Database from Model It has no capability to generate database from Model. Entity Framework supports generation of database from Model.

Source: http://jinaldesai.net/linq-to-sql-vs-entity-framework/

Entity Framework vs LINQ To SQL vs ADO.Net

there are so many different data access technologies out there that it's not uncommon for me to get the question: Why should I use the Entity Framework?  Or what differentiates it from other options like just using ADO.Net SqlClient and friends, LINQ to SQL or something like nHibernate?  I like the second question better, because the truth is that different problems merit different solutions.  So here's just a quick take on my perspective about these:

Entity Framework vs. traditional ADO.Net

All of the standard ORM arguments apply here.  The highlights are that you can write code against the Entity Framework and the system will automatically produce objects for you as well as track changes on those objects and simplify the process of updating the database.  The EF can therefore replace a large chunk of code you would otherwise have to write and maintain yourself.  Further, because the mapping between your objects and your database is specified declaratively instead of in code, if you need to change your database schema, you can minimize the impact on the code you have to modify in your applications--so the system provides a level of abstraction which helps isolate the app from the database.  Finally, the queries and other operations you write into your code are specified in a syntax that is not specific to any particular database vendor--in ado.net prior to the EF, ado.net provided a common syntax for creating connections, executing queries and processing results, but there was no common language for the queries themselves; ado.net just passed a string from your program down to the provider without manipulating that string at all, and if you wanted to move an app from Oracle to SQL Server, you would have to change a number of the queries.  With the EF, the queries are written in LINQ or Entity SQL and then translated at runtime by the providers to the particular back-end query syntax for that database.


Entity Framework vs. LINQ to SQL

The first big difference between the Entity Framework and LINQ to SQL is that the EF has a full provider model which means that as providers come online (and there are several in beta now and many which have committed to release within 3 months of the EF RTM), you will be able to use the EF against not only SQL Server and SQL CE but also Oracle, DB2, Informix, MySQL, Postgres, etc.

Next there is the fact that LINQ to SQL provides very limited mapping capabilities.  For the most part L2S classes must be one-to-one with the database (with the exception of one form of inheritance where there is a single table for all of the entity types in a hierarchy and a discriminator column which indicates which type a particular row represents).  In the case of the EF, there is a client-side view engine which can transform queries and updates made to the conceptual model into equivalent operations against the database.  The mapping system will produce those views for a variety of transformations.
You can apply a variety of inheritance strategies: Assume you have an inheritance model with animal, dog:animal & cat:animal.  You can not only do what L2S does and create a single table with all the properties from animal, dog & cat plus a column that indicates if a particular row is just a generic animal or a dog or a cat, but you can also have 3 tables where each table has all of the properties of that particular type (the dog table has not only dog-specific columns but also all the same columns as animal), or 3 tables such that the dog and cat tables have only the key plus those properties specific to their type of animal and retrieving a dog object would involve a join between the animal table and the dog table.  And you can further combine these strategies so some parts of a hierarchy might live in one table and some parts in separate tables.
In addition you can do what we call "entity splitting" where a single type has properties which are drawn from two separate tables, and you can model complex types where there is a type which is nested within a larger entity and which doesn't have its own separate identity--it just groups some properties together.  The best example of this is something like address where the street, city, state and zip properties go together logically, but they don't have independent identity.  The address is only interesting as a set of properties that are part of a customer or whatever.  As you have noticed, for v1 you can't create complex types with the designer in the EF--you have to code them by hand in the XML files.

Entity Framework vs. nHibernate

Because nHibernate is a rather full-featured ORM, the distinguishing features between the EF and it are not as large.  In fact, it is certainly true that nHibernate is a more mature product and in many ways has more ORM features than the EF.  The big difference between the EF and nHibernate is around the Entity Data Model (EDM) and the long-term vision for the data platform we are building around it.  The EF was specifically structured to separate the process of mapping queries/shaping results from building objects and tracking changes.  This makes it easier to create a conceptual model which is how you want to think about your data and then reuse that conceptual model for a number of other services besides just building objects.  Long-term we are working to build EDM awareness into a variety of other Microsoft products so that if you have an Entity Data Model, you should be able to automatically create REST-oriented web services over that model (ADO.Net Data Services aka Astoria), write reports against that model (Reporting Services), synchronize data between a server and an offline client store where the data is moved atomically as entities even if those entities draw from multiple database tables on the server, create workflows from entity-aware building blocks, etc. etc.  Not only does this increase the value of the data model by allowing it to be reused for many parts of your overall solution, but it also allows us to invest more heavily in common tools which will streamline the development process, make developer learning apply to more scenarios, etc.  So the differentiator is not that the EF supports more flexible mapping than nHibernate or something like that, it's that the EF is not just an ORM--it's the first step in a much larger vision of an entity-aware data platform.

Thursday, August 20, 2015

7 bad habits of highly ineffective software engineers

Here are seven career-breaking habits that a software engineer will want to ditch.

Software engineers want to be as effective as they can be, but some aren't hitting the mark. Many engineers develop some bad habits over their years of forging code. Here are seven career-breakers software engineers need to ditch.

1. Lacks of passion

It's cliché, but true. People who enjoy their jobs never do a day of work in their lives. After years of producing code, software engineers may lose that passion. Worse than this, it rubs off on those around them. "Even when you're coding all day, you have to be passionate enough to talk about it during lunch and after work as well," says Liz Eggleston, cofounder of Course Report, an online resource for people considering coding schools. Lack of passion leads to laziness. Laziness leads to mistakes on the job. Software engineers need to find a way to rediscover their passion.

2. Dislikes testing code

Software engineers used to think that testing code was below them—the coding equivalent of washing dishes. That's not the case today. Ineffective software engineers who believe this is still the case are either uninformed or delusional. "Testing isn't a nice-to-have, it's a must-have," says D.J. Charles, CTO of Invaluable, an online auction marketplace.
"Don't be embarrassed by bugs—good quality assurance engineering is a terrific safety net," he advises. "No one individual can identify every single test case and outcome. A bug found as a result of QA is much better than a bug in production.
"An ineffective engineer doesn't embrace the awesomeness of testing," he adds. "Top performers are the ones clamoring for test time and test automation. They do that out of experience. They've learned the hard way the importance of that."

3. Believes usability is a four-letter word

Ineffective software engineers believe their role is to deliver applications that get a job done, not to hand-hold users who use those applications to get their jobs done. They don't think of users as customers; they think of them as sources of aggravation. "It's hard to bridge an engineer's mindset into the physical world sometimes," Invaluable's Charles explains. "The ineffective engineer will incorrectly characterize a user experience issue as someone else's problem."
Unfortunately, there appear to be a lot of software engineers with that attitude, which is why companies are looking for code warriors with empathy and knowledge of other people's problems. "Employers are struggling to find people who have technical skills and domain knowledge around fundamental business problems," says Matt Sigelman, CEO of Burning Glass Technologies, a job market analytics company.
"Even good programmers will say they're not interested in understanding the business need they're trying to solve," he continues. "They'll say, 'Give me a spec. I'll write to the spec.' That's ineffective programming, and it makes it hard to even get a job."

4. Likes to say "no"

Ineffective software engineers lack "that vision thing." Because of this, they're more likely to say 'no' to a project or become a steaming pile of negativity in its path. "When presented with a challenge, a positive attitude will allow all potential possibilities to remain open," explains Charles.
"Saying 'no' closes the door on the creative process," he continues. "Whether you have an immediate idea about a solution or not, you've got to remain open-minded for inspiration to strike."
Another reason ineffective software engineers are quick to say 'no' is that once they have something working, they don't want to mess with it for fear of breaking it. "Nobody's perfect and fear of breaking things leads to safe and non-innovative choices," Charles says. "Engineers need to have the freedom to try new things. What once started as a seemingly 'crazy' path can lead to innovative and groundbreaking solutions."

5. Dislikes learning and avoids curiosity

Ineffective software engineers are reluctant learners who are resistant to new ideas. Those attitudes are costly for all occupations, but they're career-ending for software engineers. "You have to have curiosity to continue learning because programming is a lifelong learning process," Course Report's Eggleston says.
"You need to reach out to other people in the community and stay up to date on on-demand technologies because technology is constantly changing," she recommends.
Research and development conferences, online seminars, and weekly "brown-bag lunches" with peers are all learning exercises for software engineers who want to avoid being ineffective, notes Charles.
"Good software engineers have an innate need to learn, a craving at their core," he says.

6. Doesn't play well with others

Ineffective software engineers aren't team players. That can be a real problem in today's development world where teamwork is a necessity. "Software projects are increasingly complex," says BurningGlass's Sigelman. "Gone are the days where you can be a lone wolf and knock out a program on your own."
Charles points out that while ineffective software engineers may not be team players, they're still dependent on other team members. "Always remember that there are potential dependencies on what it is that you're coding—and that what you're coding has dependencies on other things that are changing," he says.
He adds that pride can contribute to an ineffective software engineer's ability to be a team player. "It's okay to get stuck now and then. Knowing when and how to get on track is a fundamental key to success. Don't let pride get in the way."
Poor communication skills can also contribute to the ineffectiveness of a software engineer in a team setting. That's especially true when the ineffective engineer has to communicate with people outside the team. "Developers who are poor communicators with non-technical team members are usually less successful," observes Eggleston.
When it comes to communication within the team, however, the ineffective engineer may need to be cut some slack, Charles notes. "Chances are you're going to find more than half an engineering team trending on the side of introversion."
"Not being able to work with someone else can be more of a personality trait and less of a conscious decision," he continues. "Getting developers into circles with other business units and getting their communications skills polished—even though it's not something they want to do—is a good way to combat that."

7. Doesn't care about security

This can be a bad habit of both effective and ineffective software engineers. In many development shops, security is just bolted on to a finished product, which isn't the best way to do it. "Developers need to put security first when they're coding," says Stephen Newman, CTO of Damballa, a cyber threat detection company.
That can be a problem, though, because even software engineers with computer science degrees aren't getting the training they need to become more than inefficient in this area. "How to construct secure software isn't even a requirement at most universities," Newman observes.
"When we're dealing with the world that we're dealing with right now, when there are so many attacks going on, you have to put security first," he adds. "A really good coder considers that in their design and their architecture and everything they do in their code."
Bad habits make employees in all occupations ineffective. For software engineers, bad habits such as showing no interest in projects and refusing to be a team player can disrupt entire teams. Many ineffective software engineers didn't start out that way, nor do they have to stay that way. With periodic self-assessments, bad habits can be identified and purged so an ineffective software engineer can become effective once more.

Source: http://techbeacon.com/7-bad-habits-highly-ineffective-software-engineers

Saturday, August 15, 2015

7 C# Interview Questions [That Weed Out The Losers!]

image

So, once again, the place I am currently working has been interviewing for some more programmers and we’ve had to laugh at some of the answers we’ve received on some pretty simple question.
For example, in answer to “How do you create an object in JavaScript?”  One applicant responded, “I always use the WHERE keyword.”  What?!!!
And that naturally got us all talking about good interview questions.  Here are a few of my favorites.

C# Interview Questions

1. What is the difference between an Object and a Class?

This is an object oriented 101 question.  So if you can’t answer this, I might try a few other questions for show, but you’ve probably already been counted out.  The way I always described the difference between the two is that the Class is like a cookie cutter and an Object is like the cookie.  The class defines what the object is going to do, but the object is the thing actually doing the work.
A more technical answer would be that the Class defines the object while the Object is the Class active in memory.

2. What is “Polymorphism”?

This is my first stab at making sure you understand the basics of object oriented programming.  Does your answer at least include the concept of virtual functions?  Here is how I explain polymorphism.
Polymorphism gets at the idea that you can have a method in a parent class and a method with the same name in a child class.  If the method in the parent class should be marked virtual and the method in the child class should be marked “overrides.”  At runtime, the decision as to which one is called is based on the type of the object that the method is called from.

3. What is the difference between overload, overrides, and shadows?

Again, this is to get at your understanding of object oriented programming generally and the sometimes confusing keywords in the language.
– Overloading gets at the concept that you can have multiple methods with the same name hanging off a given class as long as the methods all return the same type and have a different signature, the code is legal.
– Overrides is how polymorphism is implemented.
– Shadows flips polymorphism on it’s head.  If you mark a method as shadow, then instead of the method getting called based on the object type, the method gets called based on the variable type that is holding the reference to the object. So, give class A is a parent of class B and both have a method foo() and foo() is marked with the shadows keyword.  If you declare a variable of type A and point that variable to an object of type B, when you call foo off that object, A.foo() will be called.

4. What is the difference between the keyword  “String” and the keyword “string”?

I work with some pretty sharp guys and even they stumbled on this one.  Do YOU know?
When I was teaching C# for a training company, I would say, “The only difference is that ‘string’ turns blue in the editor.”  Of course now that you can configure the editor, that’s not really a good answer.  But you get the point.  Both keywords compile down to the same intermediate language.  Technically, “string” is an alias for “String”.  “String” is the proper class.

5. What is “int” an alias for?

Since we’ve already used the term alias by this point, I’m digging deep to find out just how much you know.  The proper answer is that “int” is an alias for the Int32 type.  I can forgive you if you say “class” but it really isn’t a class.  It is a type.

6. What is the difference between a value type and a reference type?

Once again, I’m trying to find out how well you know what is going on.  Do you just hack at your code until it seems to work, or do you really understand what is happening under the hood?
Again, when I was teaching this, the explanation always went something like this:
A the value of a value type occupies memory on the stack and when you do an assignment from one value type to another the data is copied from one memory location to the other.  Each variable is changed in isolation to the other.
A reference type is a variable on the stack that points to memory in the heap that actually holds the value.  When you do an assignment from one reference type to another, only the pointer is copied.  In the end, both variables point to the same location on the heap.
If you change the value of a reference type from one variable, the other variable is impacted with the change because it is the same location in memory you are changing.

7. What is the primary factor in making code testable?

OK.  You knew I had to stick this one in here, right?  I doubt most programmers have given this much thought so it is OK if they have to spend some time thinking of the answer.

Source: http://blog.dmbcllc.com/7-c-interview-questions-that-weed-out-the-losers/

Friday, August 14, 2015

Hello, Windows 10 IoT Core (Internet Of Things)

We are excited to announce the public release of Windows 10 IoT Core for theRaspberry Pi 2 and the MinnowBoard Max. Visit the Windows IoT Dev Center to choose your target board, then walk through the steps to provision your board, acquire the tools, and get started Making. This release of Windows 10 IoT Core requires a development machine running the 7/29/2015 release of Windows 10 (Build 10240) and Visual Studio 2015.

Introduction to Windows 10 IoT Core

Windows 10 IoT Core is a new edition for Windows targeted towards small, embedded devices that may or may not have screens. For devices with screens, Windows 10 IoT Core does not have a Windows shell experience; instead you can write a Universal Windows app that is the interface and “personality” for your device. IoT core designed to have a low barrier to entry and make it easy to build professional grade devices. It’s designed to work with a variety of open source languages and works well with Visual Studio.
Oh, and you can also use it to build robotic air-hockey tables.
Video Player

New in this release

The first public preview of Windows 10 IoT Core was released at the //build/ conference, and we’ve made great progress since then. Perhaps most importantly, long-awaited support for Wi-Fi and Bluetooth connectivity has arrived. The full list of new features and improvements is too long to list here but here’s a nice sampling:
  • Improved support for Python and Node.js, including a new Express Node.js project template
  • GPIO performance on the Raspberry Pi 2 has improved by 8X to 10X
  • Analog-to-digital converter (ADC) and pulse-width modulation (PWM) are now supported via breakout boards and ICs
  • New Universal Windows Platform (UWP) APIs give apps easy control over system management features like time zone and network connections

Developers, Developers, Developers

The developer experience has been a high priority for our team as we’ve built Windows 10 IoT Core, and we hope this shows when constructing apps for this platform. Our philosophy is that we want to make it easy for developers to use the languages and frameworks they prefer to build IoT device apps. This means full support for the standard UWP languages like C++, C#, JS and VB, but it also means bringing support – including full tools, debugging, and project systems – for Node.js and Python. The project templates for the standard UWP languages create projects that look like standard UWP projects, but for Node.js and Python we’ve worked hard to make these apps look and feel just like they do on other platforms. The code below shows a complete Node.js UWP app that reads from an I2C sensor and serves up a web page with the data (and you can get the sample here).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) Microsoft. All rights reserved.
var http = require('http');
//Import WinRT into Node.JS
var uwp = require("uwp");
uwp.projectNamespace("Windows");
var i2cDevice;
//Find the device: same code in other project, except in JS instead of C#
var aqs = Windows.Devices.I2c.I2cDevice.getDeviceSelector("I2C1");
Windows.Devices.Enumeration.DeviceInformation.findAllAsync(aqs, null).done(function (dis) {
    Windows.Devices.I2c.I2cDevice.fromIdAsync(dis[0].id, new Windows.Devices.I2c.I2cConnectionSettings(0x40)).done(function (device) {
        i2cDevice = device;
    });
});
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    var output = "";
    var humidity = 0;
     
    //Read the humidity from the sensor
    var command = new Array(1);
    command[0] = 0xE5;
    var data = new Array(2);
    i2cDevice.writeRead(command, data);
    var rawhumidityReading = data[0] << 8 | data[1];
    var ratio = rawhumidityReading / 65536.0;
    humidity = -6 + (125 * ratio);
     
    //Read the temperature from the sensor
    var tempCommand = new Array(1);
    command[0] = 0xE3;
    var tempData = new Array(2);
    i2cDevice.writeRead(command, data);
    var rawTempReading = data[0] << 8 | data[1];
    var tempRatio = rawTempReading / 65536.0;
    var temperature = (-46.85 + (175.72 * tempRatio)) * 9 / 5 + 32;
    output = "Humidity: " + humidity + ", Temperature: " + temperature;
    res.end(output);
}).listen(1337);
A small note about VS RC->RTM project system compatibility:
There were a variety of breaking changes in the VS project system between the //build/ and RC and RTM. For the most part, application code will remain functional, but the project itself will need to be rebuilt. The recommendation from the Visual Studio team is to build a new project and move the code over into the new project shell.

Built to work with the tools & languages you want to use – whatever they are

As part of our engagement with the broader community, we’ve worked with the community to support as many open source options as we can. You can find all of our IoT samples on Github, as well as documentation and a growing set of libraries and helper tools. Even our project system and runtime support for Python and Node.js is available open source on Github.
When our samples start turning into full projects, you can find them onHackster.io.
We’ve also worked with our friends at Arduino to make it very easy to talk to Arduino boards from Windows and even for Arduinos to talk to Windows devices as if they were virtual shields. See this project for more information.

IoT Projects for fun and profit

We built IoT Core and the corresponding developer tools to make it easy to build projects that are fun and cool, as well as those that have very practical uses in the real world. Find evidence of this in the range of projects, from members of our team, as well as the community, that have been created in the months since our first public builds.
Sampling of Hackster.IO projects:
We have more projects in the pipeline, so keep your eyes on our hackster.io hub for more information about our Air Hockey Table, Face Recognition Unlocked Door, and more.

We are listening

While you’re playing around, if you notice some rough edges, please let us know. As always, we appreciate your feedback, so keep it coming and we’ll do our best to address issues.

Quick links

  • Release Notes : Details about what is covered in this release of Windows 10 IoT Core.
  • Download Now : Click here to start downloading for FREE now. You will need the latest version of Windows 10, Visual Studio 2015 and tools.
  • Community : Share your feedback here and engage with other Makers using our forums.