ctodx

This Blog

News

Favorite Posts

Archives

February 2011 - Posts

  • Webinar: Julian on JavaScript II – objects, objects, objects

    I’m having a ball today writing my next webinar in the Julian on JavaScript series. It’s all about objects and I’m dredging up some great examples of why objects in JavaScript are well worth understanding and worth understanding well. Classes? We don’t need no stinkin’ classes! Watch to see why.

    Southern Guilford (NC) High School Street Signagephoto © 2010 Joe Wolf | more info (via: Wylio)Remember: I’m approaching the whole series from the viewpoint of a C# developer having to write and understand some JavaScript code, so all I ask is that you review the first webinar in the series if you need to before watching this one. I’ll be kicking it off at 10:00am (Pacific) on Monday 28-Feb. You can register here and review the complete list of scheduled webinars here (here’s an easy way to remember that one: devexpress.com/webinars).

    (Yikes! I have the third in the series a week later on functions: if this one doesn’t quite do it, that one will certainly blow your mind.)

    See you on Monday.

  • Voting in the Great Indian Developer Awards 2011

    Mid-April we’re off to Bangalore in India to the Great Indian Developer Summit (GIDS). And, wow, is it “Great”: they’re promising over 10,000 attendees. DevExpress is a Platinum Sponsor of the conference and those of us who’ll be there will be presenting sessions on our favorite topics (for instance, Gary and Mark will be doing a two-hander on technical debt and how to refactor your code to solve it). Even I will be donning the lapel mic and presenting, and let me tell you it’s been a while.

    GIDA 2011 logoApart from the sessions where attendees learn from the various speakers, there’s a whole slew of events, including the Great Indian Developer Awards IV presentation. This is where you come in, dear reader: you can vote for your favorite controls and libraries from DevExpress and have your name put in a hat for the first prize of an iPad. You don’t have to be there or even live in India; it’s open to everyone.

    Our products are nominated in four separate categories:

    1. Development Environment Category. CodeRush.

    8. Web Development Category. DXperience ASP.NET.

    10. Frameworks Category. eXpressApp Framework (XAF) and eXpress Persistent Objects (XPO).

    11. Database & Reporting Category. DevExpress Analytics.

    So, if you feel like trying for that iPad and voting for your favorite DevExpress products at the same time, pop over to the Great Indian Developer Awards voting form (or click on the image) and fill it out. We’d be most appreciative.

    Of course, if you’re going to be there at GIDS make sure you stop by and say hello. And if you’re feeling really adventurous come to my talk...

  • Sneak peek: the WinForms Ribbon gains a mini toolbar (coming in v2011 vol.1)

    We’ll be releasing a new Ribbon mini toolbar in DXperience WinForms v2011.1. This control emulates the familiar context toolbar in Microsoft Office applications, such as Word.

    Here’s a quick animated screenshot of the mini toolbar in action:

    RibbonMiniToolbar2

    The toolbar provides the following functionality:

    1. The use and display of any bar item, including galleries.
    2. Full support for transparency. Just like you are used to when using Word, the toolbar fades in and out depending on how far the mouse cursor is away from the context point. You can see this in action in the above image. In essence, the nearer the cursor the more opaque the toolbar; the further away, the more transparent. Beyond some distance the toolbar becomes invisible (hidden) and is not redisplayed when the cursor is moved back. All of these distances (the point at which it starts becoming transparent, at which is becomes hidden, and so on) are fully configurable. Similarly you can turn this feature off completely if need be.
    3. The ability to display a context menu at the same time if required (the animated image shows this too).
    4. The capability to customize the alignment of the toolbar to the context point where it needs to be displayed.

    Stay tuned for more sneak peeks of the new features in v2011.1.

  • DevExpress 2011 roadmap published!

    Just a quick post to say we’ve published our official roadmap for 2011. Previously it was available as a couple of webinars and a lengthy blog post in the case of VCL, but it’s now in a form you can sit down and read with a cup of coffee in hand.

    It is available here. We’ve also added some new graphics to try and impart the same information in a more visual form.

    Let us know what you think.

  • Julian on JavaScript part I: Types

    On Monday I started my webinar series on learning JavaScript when you’re a C# developer. The topic for part I was types in JavaScript. You can see the video of the webinar here.

    In this blog post, I just wanted to fill in a couple of points made during that webinar. The first one has to do with the Boolean constructor and why you shouldn’t use it. If you recall, in order to declare a boolean variable, you should just declare a variable and set it to true or false:

    var b = true; // or false of course

    If you use the constructor function you get this:

    var o = new Boolean(false); // or true of course

    The problem with this latter statement is that the variable o is an object and not a primitive boolean type. If you want to test the truthiness of that variable in an if statement, for example, you cannot just write

    if (o) { …do something… }

    The reason for this is that o, the object, is coerced to a boolean in the usual JavaScript manner. If the condition expression is undefined, null, 0, NaN, the empty string, or the primitive value false, the condition is false otherwise it is true (we’ll be discussing these truthy and falsy expressions in a later webinar). Since o is a valid object, the condition will evaluate as true despite the fact that the object encapsulates a false value.

    Instead you must test the property that “carries” the value of the boolean, namely, valueOf. Well, actually, that’s a function so you must call it to get the value:

    var o = new Boolean(false);
    if (o.valueOf())
      console.log("o is true");
    else 
      console.log("o is false"); 

    This gotcha is enough for me to recommend that you never use the Boolean constructor, just as I stated in the webinar. There’s really no need. If you see it in some JavaScript library in the wild, just walk away shaking your head.

    Secondly, there was one question asked in the webinar that I didn’t know the answer to, at least not definitely.

    “Where can I get a good JavaScript compiler?”

    My answer at the time is that JavaScript is essentially a scripting language for use in browsers. Hence every browser contains an interpreter/compiler for JavaScript and, indeed, the browser manufacturers are all in a race to provide the fastest such interpreter. I mentioned that I thought there was a Java implementation of a JavaScript interpreter out there but I couldn’t remember anything more.

    Having done a bit more research, it seems there are moves afoot to move JavaScript into other environments. Of particular note is node.js, an environment that provides the capability to write extremely scalable web servers through eventing I/O (instead of using threads/processes). It is built for Google’s V8 JavaScript engine, the one that’s built into the Google Chrome browser. Apparently V8 can be embedded in your C++ applications. There is also a wrapper for V8 in .NET called JavaScript .NET on codeplex, although it doesn’t look to be that frequently updated.

    (The JavaScript interpreter that’s written in Java I was faintly remembering during the webinar was Rhino. Rhino can be embedded in Java applications to provide a scripting engine for end-user functionality.)

    My next webinar in the Julian on JavaScript series will be Monday February 28 at 10:00am Pacific Time, and will focus on objects. It’ll be time to throw away your understanding of class models and embrace duck typing instead. Until then…

  • DevExpress Newsletter 42: Message from the CTO

    For this message, I’m continuing my discussion of the SOLID principles with L.

    The L in SOLID - The Liskov Substitution Principle

    Let's continue our discussion of the SOLID principles. Today we'll look at the L in SOLID: the Liskov Substitution Principle.

    This one is simple in the extreme: Subtypes must be substitutable for their base types. Named after Barbara Liskov who first formulated it in 1988, it's the principle at the heart of any class inheritance chain. If you write a function or a class that uses a parameter or variable of some base class then you should be able to pass an instance of some descendant class and the behavior should remain exactly the same.

    Unfortunately I don't have any examples of this from my own code since I have long since embraced this principle, so I'll have to make something up. Suppose we have a base class called Bird that has a virtual method called Fly.

    abstract class Bird {
      abstract void Fly();
    }

    Then you could write a descendant Duck class that overrode that method to do something pertaining to how ducks fly.

    class Duck : Bird {
      override void Fly() {
        Quack();
        FlapWings();
        Jump();
        ...
      }
    }

    Everywhere that expected an instance of Bird could be passed an instance of Duck and everything would work just fine.

    And then someone wrote an Ostrich class.

    class Ostrich : Bird {
      override void Fly() {
        throw new NotImplementedException();
      }
    }

    The problem here is that, although an Ostrich instance is substitutable for a Bird instance, it introduces some new breaking change to every place a Bird is asked to Fly: an exception is thrown because of course ostriches don't fly. This descendant class breaks the LSP: you are introducing new behavior into existing code by writing a descendant of the base class.

    Now, sure you can go back and make some modifications to your Bird class to take account of this new functionality, but consider this: in doing so you are violating the open-closed principle, OCP. That is, classes should be open for extension but closed to modification.

    As you can see: the LSP is closely linked to the OCP. If you follow LCP, your class hierarchy will follow OCP implicitly. You are creating base classes that can be extended ad nauseam by writing descendant classes, all the time ensuring that you don't have to modify the code of the base classes.

    You can watch the video here. (Now updated.)

    The problem with this principle is that everyone assumes that everyone else knows and applies it as well as they do. And yet I continue to see examples where the principle is violated. Possibly the best (or should that be worst?) example I remember is the one where the class hierarchy was something like BaseClass, FirstDescendant, DescendantOfFirst, with some virtual method X. In DescendantOfFirst.X, the developer wanted to skip calling the overridden version in FirstDescendant, and go directly to BaseClass.X. Brrr.

    The same principle applies with duck typing in languages that don’t really have a class model. Here the function being called assumes that an object being passed to it has some well-defined methods. Objects that implement these methods should be substitutable for the object prototype the function expects. For instance, in Java Script:

    var flyAway = function(animal) {
      animal.fly();
    };
    
    var flyingSquirrel = {
      ...
      fly: function() {
        leap();
        glide();
      }
    };
    
    flyAway(flyingSquirrel);

    As before, the whole series is based on papers written by Uncle Bob (Robert C Martin). Click here for the PDF on LSP.

    (I’ll note that this avian example for the Liskov Substitution Principle came from Bertrand Meyer’s seminal Object-Oriented Software Construction.)

  • Webinars: Julian on JavaScript

    Almost forgot: I’m presenting an initial series of four webinars on JavaScript for C# programmers over the next couple of months. They’re designed for C# programmers who haven’t really dabbled in any great depth in writing JavaScript and will introduce some language basics and point out some common errors you can easily avoid. Note that this initial series is about JavaScript in particular, and not about manipulating the DOM, using jQuery or other libraries.

    Monday February 7 at 10:00am Pacific: webinar 1. This one’s on types in JavaScript. Despite the fact that you can declare variables without declaring their type, JavaScript still has an underlying type system. We’ll look at the 6 possible types, none of which include the class type.

    Monday February 28 at 10:00am Pacific: webinar 2. We’ll talk about objects and a little bit about functions (after all an object’s constructor is just a function). We’ll introduce prototypal inheritance.

    Monday March 7 at 10:00am Pacific: webinar 3. This time we’ll talk about functions in more depth and introduce scope and closure.

    Monday March 28 at 10:00am Pacific: webinar 4. For the final webinar in this particular series we’ll discuss common pitfalls, globals, bad JavaScript, modules, good JavaScript, and anything else we have time for.

  • Got Delphi XE Starter? Want to install our controls? Tough.

    A hint of some strong emotion, perhaps, but let me explain why. The problem isn’t with you, the problem is with what Embarcadero have done in order to produce a Starter edition of Delphi XE. First, a bit of background.

    Last week, Embarcadero announced the release of the Starter editions of Delphi and C++Builder XE. I, as CTO for the premier third party vendor in the VCL space, actually learned about it from an article in SD Times, not Embarcadero. Nice.

    Here’s the blurb about the editions, from an email to all partners I received at 4:00 pm today:

    Delphi XE Starter and C++Builder Starter are a great way to get started with rapid, visual, Windows application development. The Starter editions include a streamlined IDE with a code editor, ultra-fast Delphi compiler or popular Embarcadero C++ compiler, and an integrated debugger.

    They also offer two-way visual designers to speed development, hundreds of visual components, and InterBase Express for connectivity with the InterBase database.

    Getting started on realizing your product vision or getting your startup off the ground can be difficult without seed capital or sales revenue. Outfitting developers with professional level tools can be cost prohibitive before you have product to sell. So the Starter Edition is both designed and priced to allow individuals and startups to  bootstrap their vision until related revenues reach $1,000 at which point a specially priced Professional Edition license can be purchased.

    A great idea for an entry-level product that the community has been asking for ever since the Turbo editions from a couple of years back. And they come without the “can’t install any controls” limitation from those older editions. See, here’s what it says later on in that email:

    Delphi XE Starter and C++Builder XE Starter don't have the restrictions on adding components and tools like the old Turbo Explorer products did. Starter edition users can install and use commercial components and tools from technology partners.  This means new customers for you.

    Sounds good, yes? Win-win all round, right? Except…

    You see, over the past 6-9 months or so, I must have explained how our installer works to several people at Embarcadero, with regard to another initiative happening there. It seems, to a man, they’ve completely ignored it. Let me explain it to you dear reader. As I’ve stated many times recently, at this present time we support 14 possible compilers with our VCL products. Since DCUs change with every version of the compiler, we either add every single DCU of our source files for every single compiler in our install, or we kick off a compilation step during the install to create the DCUs and run-time/design-time packages on the fly using the compilers you have on your machine. (And this is exactly the reason we don’t provide trial editions.) Once we have the design-time packages we automatically register them with your IDE. Brilliant solution, yes? (I hasten to add I bet many vendors use the same trick, it’s not like we’re the only ones.) Even with this compile-on-the-fly solution, our install is fairly chunky but is still WAY smaller than including all the precompiled DCUs, etc.

    So, what’s this got to do with Delphi XE Starter? Well, one of the restrictions of the Starter editions is that dcc32.exe, the actual Delphi language compiler, can only be called from the IDE. Indeed, if you call it from the command line, it gives you this:

    image

    (Thanks to JD Mullin of Sybase for the image. It was he who alerted me to this whole situation at 6:30 this morning and I’m not going to let him forget it.)

    So, the long and short of it is this: if you try and install our VCL Subscription into Delphi (or C++Builder) XE Starter, the installer will fail. It won’t install anything because nothing could be compiled to install.

LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2017 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners