Thursday, May 11, 2006

Is there even an argument? VB.NET vs C#?

First, let me start off saying where my loyalty lies, I'm a C# guy.

I've recently been doing a great deal of work in VB.NET and I wanted to share with you what my thoughts are.

C# and VB.NET are identical in form and function. They can both be used to build the same identical systems with exactly the same code. There's no real difference - the beauty of the .NET Framework.

So what's this post about? Well it's about how I feel when writing code in the two different languages. What I write here is not about what's right and what's wrong, it's just opinion (personal opinion at that!).

To me, VB.NET feels like a very solid stable language, with well defined boundaries. Bold colours - you get what you see.

C# seems to be much more subtle, it feels less solid, the boundaries are there, but they're much softer, it's much harder to tell what you have in front of you with C#.

I don't get the same sense of completion with VB.NET as I do with C#, when I write code in VB.NET I know the code will do the job, but it just doesn't feel finished.

I wondered, is this because I just have not used the language enough which got me back to thinking about when I first started to learn .NET.

Way back in before .NET was released I was using VBScript and decided to try out the new .NET stuff, using the language I already knew - VB.NET (I mean it even had the same name!). I tried for about a month in my spare time to learn VB.NET, but I just could not get my head around it - all of a sudden I had all of these Object things to deal with and all the nasty casting going on - I really missed varients. I gave up on .NET and went back to VBScript - I knew it and knew it well.

A couple of months later I decided to give .NET a shot, but this time, I opted to give C# a go, see if I could lose the familiarity I had with the VB languages and teach myself .NET instead. This time round I found .NET much easier, the code samples were there, mostly in C#, the community was there, everyone was using C#, it just seemed easier for me to get my head around, all of a sudden these Object things gained a life of their own, I was able to write Classes and use design practices to ensure they were clean and tidy. I got .NET, and have never turned back to VBScript since that day.

So does the fact I learnt .NET with C# taint my feelings with the topic of VB.NET? I'm pretty sure it does. Is this a bad thing? Well for me at the moment, yes it is, I'm working with VB.NET quite heavily and I don't feel confidant in my code, a feeling I never really have with C#.

VB.NET is solid - I feel it does the job, but it just feels more chunky, rugged, designed for the world where it will be haphazardly put together. VB.NET to me is like Duplo (which for those who don't know is Lego for Toddlers - larger bricks, easier to use).

C# feels much more precise, it's smaller, easier to manipulate into a finer much more intricate design, it feels like it's better than VB.NET (which as I've already stated - it isn't they're equal in EVERY way).

So there you have it, VB.NET & C# side by Side do the same job, in the same way - they can both achieve wonderful things with morealess the same amount of code, okay, one language might have features the other doesn't, but essentially, they're pretty much identical.

The only real difference is the perception of developers who use either language. How someone overcomes this difference is beyond me, I'm looking to find a solution to the problem and to banish my VB.NET demons - I need to feel confidant that the vB.NET I write is a solid and as stable as my C# code - maybe I need to see a psychiatrist.

Reference: Phil Winstanley Blog

00:20 Posted in Programming | Permalink | Comments (0) | Email this | Tags: microsoft

Wednesday, May 03, 2006

Avoid .NET “partial” classes in C# and VB

Microsoft added a new keyword to C# and VB for 2005 (CLR 2.0): partial

Don't use it.

partial is used to physically break up a class definition into multiple files. When the compiler sees the keyword partial it finds all the related partial files in order to compile the class. This makes it possible to split the code for a single class across multiple files. By and large, though, this is a bad idea. Let’s look at why that is.

If you find
yourself typing
"p-a-r-t-i-a-l"
Stop!

Reasons Given To Use the “partial” keyword

There are three main incentives I’ve heard for using partial, according to Microsoft and others:

  1. If a class is really large, break it into multiple files so more than one person can work on it at a time.
  2. If a class implements multiple interfaces, put the methods that implement each interface into a separate file.
  3. When the IDE generates code, it puts the code into a separate file so you don't see it or accidentally modify it.

Let's examine each of these reasons in detail.

1. Avoid using “partial” to break large files into many smaller files—so multiple people can work on them. This is a bad practice.

Why?

No matter how you try to group code in various partial files, you will never see the big picture for the class anymore. It’ll become brittle, easily broken. By only viewing a portion of the class, you can too easily break some assumption or dependency in the rest of the class. For example, you won’t see all the internal fields. If a field needs updating, and it’s not referenced in the portion of the class you’re editing, you’ll never even realize that you are breaking the class. People will make incompatible changes and no one will know until Humpty Dumpty is put back together again. Are your unit tests good enough to catch this?

So what's the right solution for really large files?

If you’re thinking of using partial because your class file is large, then consider it a warning sign that it's time to break the class up—not by using partial but by using object oriented design. Break your monster class into multiple classes, grouped by responsibility. That way, you can hide details inside classes, and it will be much harder for developers who work on the new smaller classes to make incompatible changes with each other. As a bonus, breaking it up will also make your code easier to read, test, and maintain.

2. Avoid using “partial” to organize your class file. Some people suggest putting the implementations of each interface into their own files. This sounds reasonable at first, but it contains a pitfall—the class implements 2 or more interfaces, but it is still one class that has its own private data (and all the assumptions that go with that). If you only read code in one file and make changes, you may not realize the side effects you introduce on other methods that are in other partial files. This is a bad practice for the same reason that it was for reason #1, large class files.

 

3. “partial” is ok if the compiler puts it there. This is the only safe reason to use partial. When the compiler adds partial to your class, it does so to hide the code that it generates. While there are other solutions to handling generated code, this is the one that Microsoft chose, and it works fine. You can't ever modify the generated code (well, not easily) so it's just as well that it's hidden in a separate file. Note the key phrase here: the compiler adds partial—not you.

Recommendations

  • If you find yourself typing "p-a-r-t-i-a-l" — stop! Don’t do it.
  • If the class you’re working on is marked partial, make sure that the other partial bits are compiler-generated. If they’re not, you should consider putting the class files back together and re-factoring the large class into smaller classes.

One final Note: in VB, since the partial keyword is optional, you can really confuse someone reading the code because they may not even realize that other code exists for this class. If you work in VB, be aware that your entire class may not be in the file you’re looking at.

For another viewpoint, see these articles:

source: http://geekswithblogs.net/dchestnutt/archive/2006/04/05/7...

14:05 Posted in Programming | Permalink | Comments (0) | Email this | Tags: microsoft

Monday, May 01, 2006

Firefox backers aim to 'destroy' IE with campaign

Summary: Explorer Destroyer launches aggressive campaign to get users to switch from IE to Firefox.

A group of self-titled "political activists" in Massachusetts has started an aggressive campaign to get browser users to switch from Microsoft's Internet Explorer to Mozilla's Firefox.

The campaign, called Explorer Destroyer, takes advantage of a new program by Google to pay users $1 for each referral to Firefox made through Google Toolbar, according to the group's Web site.

"You already want people to switch to Firefox. Now's the time to get serious about it," according to the site. "Google is paying $1 for each new Firefox user you refer. ... Now you can advance your ideals, save people from popups and spyware hell, and make some serious money."

Google did not return calls seeking comment for this story, but the search giant offers a standard $1 per user referral fee to Web sites that generate new downloads of Firefox with the Google Toolbar.

According the Explorer Destroyer Web site, the group offers Web-site owners scripting technology that will detect if a visitor is running IE. If so, an alert will appear directing them to download Firefox either to view the site better or at all. Whenever a visitor to a Web site using the group's technology switches to Firefox from IE, the owner of the Web site will get the referral fee if they have signed up for Google's AdSense program.

There are three types of alerts site owners can put on their page -- "gentle encouragement," "semi-serious" or "dead serious."

If a Web site owner chooses "gentle encouragement," visitors to a site who are using IE will see a banner across the top of the page that encourages them to download Firefox. A "semi-serious" site will put up a splash page encouraging a user to download Firefox, with a link for downloading Mozilla's browser as well as a link to the Web site.

Those who choose the "dead serious" rating actually block users with IE from viewing the page, informing them they must install Firefox to view the site. A demo of what happens when a user clicks on a site with this rating can be found here.

In addition to the Explorer Destroyer Web site, where users can download the scripts for their sites and learn more information, the group also has launched another Web site that parodies IE and provides users with reasons why they should switch to Firefox here.

One reasons for switching, according to the site? "It will make Bill Gates soooooooooo mad." "Seriously-- super, super mad," the site goes on to say. "And even more than Bill, let's think about Steve 'I'm going to ... kill Google' Ballmer for a second. If there's anyone that's going to absolutely blow a gasket when they see this Web site, it will be him."

Other reasons the site offers for switching from IE to Firefox include, "Reduce your weekly family and friends tech support load to eight hours" -- a reason that pokes fun at various problems users encounter when using IE -- and "If we knew Web designers would hurl themselves off it, we wouldn't have put the Golden Gate bridge so close to San Francisco," which cites developer difficulties in making Web sites IE-compatible.

The Explorer Destroyer group did not immediately respond to an e-mail requesting an interview Tuesday. An open letter about the campaign can be found here.

A Mozilla spokeswoman declined to comment on the group's efforts and Microsoft did not immediately return requests for comment on Tuesday.

10:35 Posted in WinFX | Permalink | Comments (0) | Email this | Tags: microsoft

Saturday, April 29, 2006

Windows Vista sessions and demos

You might be wondering what’s in it for you, when your organization should start evaluating Windows Vista and when you should set up a pilot. This session will give you an introduction and overview of the features that Windows Vista will offer. You will get a clear picture where the big changes are and what direction Windows client operating system is taking.

So you did not find time to install a Beta yet? You are wondering what all the talk about the new User Experience is? How working with Windows Vista will differ from using XP today? Tony Krijnen demonstrates Vista key features from a User perspective.

Windows Vista Demo Part 1, 36 minutes
Windows Vista Demo Part 2, 24 minutes 

08:25 Posted in WinFX | Permalink | Comments (0) | Email this | Tags: microsoft

Friday, April 28, 2006

Final Names for Windows Vista Performance Features

Windows PC Accelerators is the new term that encompasses Windows Vista’s new performance-enhancing technologies. The Windows PC Accelerators are:
  • Windows® SuperFetch™
  • Windows® ReadyBoost™ (formerly code-named “EMD”)
  • Windows® ReadyDrive™ (formerly code-named “Piton”)

Windows SuperFetch™ is a memory management innovation in Windows Vista that helps make your PC consistently responsive by tracking what applications are used most on a given machine and intelligently preloading these applications into memory.

Windows ReadyBoost™ (formerly code-named “EMD”) makes PCs running genuine Windows Vista more responsive by using flash memory on a USB drive, SD Card, Compact Flash, or other memory form factor to boost system performance.

Example: Windows ReadyBoost™ is an easy way to make my computer feel faster. I just put in a USB key and follow the instructions on the screen.

Windows ReadyDrive™ (formerly code-named “Piton”) enables Windows Vista PCs equipped with a hybrid hard drive to boot up faster, resume from hibernate in less time, and preserve battery power. Hybrid hard drives are a new type of hard disk that integrates non-volatile flash memory with a traditional hard drive.

Source: http://www.neowin.net/index.php?act=view&id=32740

04:05 Posted in WinFX | Permalink | Comments (0) | Email this | Tags: microsoft

Thursday, April 27, 2006

Mixed feelings!

You know when people say that sometimes if though you are very good in something, still bad things will happen. Yesterday's Momentom session went bad.. It was not one of my cool funny enjoyable sessions. maybe its the topic, maybe it is the audience, or maybe its just Lebanon! Let's discard the Lebanon thing for the mean time for the fact I delivered 2 sessions in the Office Readiness event and 1 Community Night for Lebdev and they were extra successful. Yesterday's session was boring I totally agree, but with whom? I mean I found it boring but the session got an average 8/10 from attendees feedback.. That is really weird.

Let's go back now to the fact that why I blamed Lebanon in the first place. The night before Momentom I had already washed my clothes at a friends place so I just needed to press them, but life is not easy, it's like when you decide to press your clothes you are willing sin! Guess what?!! the iron was not working properly and I burnt my first shirt! ouch =( hala2 so I told him that we have press them somewhere else, say his parents house for example and he agreed. It was 12:30am by then, we started the car and cruised, tak tak taaaaaaak! they care stopped working, we ran out of gas! yields we parked the car and started walking looking for a gas station, finaly we found one, got some fuel and back to the care and to Sacha's parent's house, now the sarcasim goes, guess where they put the iron, somewhere near there bed. buy the it was almost 2:00am so we won't risk waking them up, 3eeeb sa7? Another factor was bugging us too, hala2 regardless ino kan 3andi event the next day, o ino I don't have clothes to wear, hunger was killing me. So we went to a place called "Breakfast to Breakfast" in Saseeen Yard and got some food and back to his place were I placed a peace of wet cloth on my shirts started pressing, it was 3:00am. finally finished pressing at 3:30am and went back to the hotel at 4:00am. toke a shower and shaved!! now it's 5:00am and I'm dead asleep. and rrrrrrrrrrrrrrrrrrrrrrrrrring its my alarm clock, it was 7:00am, now with 2 hours sleep and a lousy night like that I realized ino It cant go anyworse, can it?

Thank god it didn't!

I'll post couple of videos I recorded during Momentum on my blog soon. =)

peace and happiness!

PS: wondering about the above spelling mistakes and crazy language, fact: this is how lebanise speak english!!


 

10:25 Posted in Blog | Permalink | Comments (0) | Email this | Tags: microsoft

Sunday, April 23, 2006

Windows Live Messenger 8.0.0683.00



This new build, 8.0.0683.00_Branches contains the new UI, new icons, and now uses the Windows Live ID service.

With Windows Live Messenger you can chat online via text, voice or even video conversation - in real time - with your friends, family or colleagues. It's faster than e-mail, a great choice for conversations and the perfect alternative when you can't be there in person.

Updates:
- The welcome interface changes to its first version.
- Main content screen.
- The chat window also is totaly re-designed.


Download!

16:30 Posted in Blog | Permalink | Comments (0) | Email this | Tags: microsoft

Saturday, April 22, 2006

Will Vista Be the Last Operating System Microsoft Produces?

I don’t think Microsoft will ship another Operating System after Vista launches. I believe that a combination of technical difficulties and changing markets will prevent it from creating a product that is relevant in the market. Consider this, if the latest shipping dates are to be believed, it will have taken Microsoft over six years to get Windows Vista out the door and to its consumers. And based on past events, it is safe to assume that Vista will require at least one service pack before it is truly ready for use. Of course, factoring in the normal Microsoft delays for producing patches, such a comprehensive service pack will probably take another year before it can be released to users. That would mean that it will have taken Microsoft 7+ years to make a usable operating system.

Now consider how long it could take Microsoft to produce Vista’s successor. If the added complexity of this new OS increases the development time by only 25% (not an unreasonable figure) of what it took to make Vista, then it will have been in development for almost 8 years. That means if Vista comes out in 2007, it won’t be replaced until 2015. To put that into perspective, if Apple continues on with its release cycle of OS X (and factoring in increases in development time) they could, counting Leopard, release 4 to 5 new operating systems by the time Microsoft releases one.

But keeping up with Apple won’t be Microsoft’s biggest concern. What will prevent Microsoft from releasing another OS is the changing market. For Vista’s successor to have a hope of selling, the company has to assume that no fundamental shifts in technology will occur for almost a decade! That seems, overly optimistic at best. With Google threatening to release a web-based OS, and Apple potentially using virtualization to run all Windows applications, Microsoft might find that by the time it can cobble something together, it no longer has a market interested in its product.

Microsoft will find itself in this position (or one like it) all too soon, and it has no one but itself to blame. Here are the two biggest factors that are slowly killing Microsoft from within.

Code base
The amount of code that makes up Windows has simply become too large to work with. Now, you can blame this on anything you want (backwards compatibiliy would be high on my list), but ultimately the cause doesn’t matter. What matters is that building new features has become impossible, and debugging this mess has become impossible + 1. This was most clearly witnessed when Bill Gates got up onstage and informed his eager audience that the codebase for Vista had become so large and tangled that they simply had to throw it all away and start over from a point they knew was stable. Guess what? That problem isn’t going to go away by throwing another service pack at it. With each version of Windows released the amount of code grows and the strain gets greater. However, the amount of code isn’t the only problem here. The structure of the OS itself is fundamentally flawed. There are too many antiquated ideas (drive letters, the registry, etc.) and constraining bounds (NTFS) to allow for anymore growth. A drastic rewrite is the only way to solve this problem. The only real question Microsoft needs to ask is how much should we rewrite?

Management
The last few years has seen a flurry of restructuring at Microsoft. Key people have left (most noticably for Google) and even loyal employees who still believe the hype have begun to criticize management and air their grievances on personal blogs. The leadership of Microsoft has failed miserably and Vista is only the beginning in what looks to be an impressive series of embarrassments. It is time for a change. If Microsoft still hopes to be in the OS market a decade from now then those changes can’t come soon enough.

http://www.applematters.com/index.php/section/comments/wi...

 

13:15 Posted in WinFX | Permalink | Comments (0) | Email this | Tags: microsoft

Friday, April 14, 2006

Forcing Glass on Non-WDDM Compatible Cards

WARNING: This tweak may cause a blue screen loop or constant flicker depending on your video card. Use with extreme caution.

  • From the Start menu, click All Programs and then expand Accessories.
    Right click on “Command Prompt” and click “Run as Administrator”.
  • Click on “Allow” from the Windows Security dialog.
  • In the Command Prompt window, type “regedit” (without the quotes) and press Enter.
  • Navigate to HKEY_CURRENT_USERSoftwareMicrosoftWindowsDWM (if this key doesn’t exist, create it)
  • Create a new DWORD (32-bit value) of UseMachineCheck, and set its value to 0.

06:15 Posted in WinFX | Permalink | Comments (0) | Email this | Tags: microsoft

Sunday, April 09, 2006

Microsoft continues to build IP licensing portfolio

In a continued effort to derive revenue from licensing patented technology, Microsoft plans to let third parties license intellectual property it developed for its own mouse products.

Microsoft will open up licensing for three technologies - Tilt Wheel, U2 and Magnifier, said David Kaefer, a director of business development for Microsoft. It marks the first time the company is licensing patents for hardware technology, he said.

Tilt Wheel is mouse technology that allows a user to scroll not only up and down but also horizontally with a mouse's flywheel. U2 allows a mouse or other peripheral device be immediately recognized by a computer's port even if the port it is using is not native to the device. For example, if a USB device has to use a PS/2 port by using an adapter, the technology will allow the peripheral to work seamlessly without needing any extra software on the hardware device to which it is attached. Magnifier allows a cursor on a screen controlled by a mouse to immediately magnify parts of the screen with one click.

Tilt Wheel and U2 will be licensed to users for 30 cents and 35 cents a unit, respectively. Microsoft has not decided on the pricing for Magnifier yet, but it will likely be similar to that of Tilt Wheel and U2, Kaefer said.

Microsoft has offered mice that include Tilt Wheel and Magnifier for only about a year, he said. U2 has been around longer than that and already other companies have built similar competing technologies into their products.

Microsoft thought it was the right time to begin licensing all three technologies before other companies build their own to compete with them, he said. In this way, the company can begin making money every time another vendor sells hardware using its patented technology.

Licensing patented technology to third parties is a fairly new practice for Microsoft. In 2003, the company hired Marshall Phelps, the mastermind behind IBM's patent-licensing program, to lead its Intellectual Property Licensing Group, hoping to follow IBM's success in making money from charging third parties to use technology it has patented.

IBM has earned the most patents of any company worldwide for 13 years running. According to its 2005 financial statement, the company that year earned nearly $367 million in royalty-based licensing fees and $236 million in sales and other transfers of intellectual property.

Rob Enderle, principal analyst for the Enderle Group, said Microsoft is interested in seeing its own patent-licensing business grow not only to make more money, but also to have a hand in directing future uses for products that use its intellectual property.

"Microsoft has learned over time that license revenue goes straight to the bottom line and has virtually no risk associated with it," he said. "More importantly, if what you license is broadly used, it gives you substantial say on the direction of future offerings that use your stuff."

13:05 Posted in Blog | Permalink | Comments (0) | Email this | Tags: microsoft

All the posts