Structural typing, or did OO get interfaces wrong?

Lapsang logoLately I have been doing a lot of thinking about programming languages and how ideas change over time on what constitutes good language functionality. As I enjoy playing around with grammars and parsers, I naturally started thinking about the idea of designing a hypothetical language of my own and what form it would take. One area that I was keen to address is OO’s interfaces and inheritance. It’s a topic I’ve had many heated debates with various people over the past couple of years and so it seemed a natural place for me to start. As I was trying to work out how best to express my ideas, Microsoft launched TypeScript. It implements what I feel interfaces should have been all along and even gave me an “official” name for the technique: structural types. Continue reading “Structural typing, or did OO get interfaces wrong?”

Porting Ash to C# – Initial steps

At October’s Try { Harder } conference this year, Richard Lord – author of the entity framework, Ash – gave a great talk on entity frameworks. His talk confirmed something I’d been thinking recently, namely that the use of entity frameworks does not need to be limited to games. I’d recently worked on a domain-specific file crawler and processing application that adopted a timed loop to check for new files, progress in processing those files and updating the user on progress. Even this application would have benefited from using an entity system framework to control the interaction of its various parts. So after a quick chat with Richard to check the practicalities of my ideas, I decided to port Ash to C#. Continue reading “Porting Ash to C# — Initial steps”

Project FlaXe update: RIP Project FlaXe

haxe logoBack in November, just after Adobe announced they were donating Flex to Apache, I posted a suggestion for a Flex salvage project. This project would involve porting the Flex AS3 code to haXe and using the latter’s ability to target JavaScript to turn Flex into a framework that could run on HTML5. Continue reading “Project FlaXe update: RIP Project FlaXe”

Announcing “Project FlaXe”, a vision for the future of Flex

haxe logoAs you’ll likely know, if such things interest you, Adobe pretty much succeeded in killing off Flash last week. They made nearly 10% of their staff redundant. They abandoned the Flash player for mobile browsers. They possibly made most of the Flash Pro “IDE” team redundant (though what has really happened to that team remains unclear.) And late Friday, they announced that they were pulling out of future Flex development and handing Flex over to the community.

The timing of these announcements by Adobe is regrettable. They have spooked the community and left many of us who build on Flash technologies as part of our business unsure of the short to medium term future of Flash. Yet there is currently no alternative RIA solution that can equal Flex. What other solutions there are use very different technologies. making migration difficult at best.

This set me thinking: could the community create a way of migrating existing Flex solutions away from the Flash player? Continue reading “Announcing “Project FlaXe”, a vision for the future of Flex”

Flash programming tip: global vs static functions

A fairly common feature of most object-orientated (OO) languages is the concept of globally accessible functions, which are wrapped up inside classes. In order to make them globally accessible, they’ll be defined as static methods, or whatever the syntactic equivalent is in the particular OO language in question. Continue reading “Flash programming tip: global vs static functions”

Beginner’s guide to SWF internals

I have recently pushed the initial version of a new framework – the AS3Introspection library – up to github. AS3Introspection can decode a SWF and generate a representation – by default as XML – of its code contents. Whilst writing an introduction to AS3Introspection, it occurred to me that for someone to understand how it works, they would need at least a basic understanding of the internals of a SWF. I have therefore written this article to hopefully provide that basic understanding. Continue reading “Beginner’s guide to SWF internals”

AS3 User-defined generics: why they are not possible (yet)

With Flash Player 10, Adobe introduced a special data type to ActionScript 3 (AS3): the Vector class. The Vector class is a type-safe array class. In other words, the elements of an instance are guaranteed to all be the same type. It achieves this by being a parameterized type, or as such types are commonly known, it is a generic type. Continue reading “AS3 User-defined generics: why they are not possible (yet)”

AS3, DTOs, getters/ setters and good practice

Yesterday I was adding some member variables (fields) to a simple AS3 Data Transfer Object (DTO). The existing fields were all marked private and there were public get/ set methods (properties) defined for them that did nothing but read and write to the fields. I really dislike using properties in this way. I can understand why one would do so in Java, as it lacks true properties and instead has getter and setter methods. Changing from a field to those methods changes a class’ interface, which necessitates rewriting any code that uses them. In AS3 though, this problem doesn’t occur. Continue reading “AS3, DTOs, getters/ setters and good practice”

Field = Attribute = Property = Getter = Method = Member. WTF?

When I started learning about Object Orientated (OO) programming some 15 years ago, I was taught a set of terms to describe aspects of OO: class, object, method and field. In recent years, I’ve added one more term to the list: property. Whilst in my own mind, these terms have clear meaning, such meaning is not universal. Continue reading “Field = Attribute = Property = Getter = Method = Member. WTF?”

AS3Enum preprocessor poll: I need your votes!

AS3 EnumsFor the past few months, I have been occasionally working on a sideline project called AS3Enums. It is a preprocessor for AS3/ Flex/ Flash, which adds powerful enum support to AS3. Being a preprocessor, it is designed to run via ANT, the command line, the “external tools” feature in FlexBuilder, FlashBuilder, FDT etc. Continue reading “AS3Enum preprocessor poll: I need your votes!”