Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

Children in JSX

posted in JavaScript on 2017-01-06   todo header component return props children function todos classname todolist title

(This article is part of React in patterns series.)

React is highly composable. And the API that enables that is props.children. It gives us the power to create a placeholder that is later filled with content from the outside.

read more

React.js in patterns

posted in JavaScript on 2016-07-20   component react title props header data app extends react component class

Long time I was searching for a good front-end framework. Framework that will help me write scalable and easy to maintain UI. Even though React is just a library for rendering it comes with so many benefits that I can easily say “I found it”. And like every thing that I use a lot I started seeing some patterns. Techniques that are applied over and over again and I see in the code of other developers. It’s time that I start documenting, discussing and sharing these patterns.

read more

Let's write, not generate code. Thoughts about naming stuff.

posted in JavaScript on 2016-07-03   code data html classes naming css good tags

I’m writing code for approximately ten years now and at some point the word “writing” became more important then “code”. I found out that it is easy to generate code but it is difficult to write code. Writing means creating something meaningful. Something that other human beings will read. The code is indeed sent to machines and they do understand ugly code. Not the same for humans though. An important part of our job is to make sure that our code is clear for other teammates.

read more

The bare minimum to work with React

posted in JavaScript on 2016-06-13   react app function file babelrc return babelify browserify render superclass

The setup here is available at GitHub here.

Half an year ago I published A modern React starter pack based on webpack. The starter provides the basic tooling around React. However, I noticed that very often I need even less stuff than that. That’s usually when I want to hack something quickly. In this blog post we’ll see what’s the bare minimum to work with React.

read more

CSS variables are here for ages

posted in CSS3 on 2014-08-13   div content font size color container css width div class footer variables

Every front-end developer that starts reading about CSS preprocessors thinks “Oh, finally variables in CSS". Indeed, the ability to create and use variables in CSS makes our code much more flexible. However, I think that there is no need to use a preprocessor to create flexible stylesheets.

read more

A bad side effect of the aspect oriented programming

posted in JavaScript on 2013-08-15   thing result function thing prototype dosomething start prototype dosomething function aspect oriented programming problem original class

I just read this very interesting article published on know.cujojs.com. It's about aspect oriented programming. At the beginning I thought "Oh, that's kinda cool", but when I start thinking about how I'll use it in practice I notice something bad. The blog post itself is well written and informative, but doesn't include any cons of the used technique.

read more

Introduction to animations in HTML

posted in HTML5 on 2013-07-30   animation var animations css function element class add

Last few years designers use a lot of animations directly in the HTML. That's of course kinda cool, because you don't need a plugin in order to see their work. There are several ways to make animations in HTML. It's an interesting subject and I decided to make a short research and summarize the information.

read more

JavaScript is cool

posted in JavaScript on 2013-07-23   var function class return instance pubmethod module event function return

I'm writing a lot of JavaScript these days. Sometimes it's really crazy what you can do with that language. I have bunch of tools in my arsenal and I wanted to document them somehow. Writing an article is a good option. By tools I mean patterns, piece of logic or just syntax shortcuts. However, this article is not exactly about design patterns, but it uses some of them. It's just about few ideas, which I came into during my daily scripting.

read more

API Design by Matt Gemmell

posted in Architecture on 2012-05-25   strongly recommend helpful article check class write

Did you ever wonder how to write your class. That's a very helpful article. I strongly recommend it. Check it here.

read more

Dependency Injection in PHP. Create your own DI container.

posted in PHP on 2012-05-12   class key view show arguments array content navigation title skills

By my opinion one of the biggest problems in programming are dependencies. If you want to have a good well written application you should avoid dependencies between your modules/classes. There is a design pattern which could help and it's called Dependency Injection (DI). It allows you to inject objects into a class, instead of creating them there.

read more

The Single Responsibility Principle (SRP)

posted in Architecture on 2012-01-03   principle responsibility class responsibility principle srp single responsibility principle software design read hard changing motive opinion fundamentals

In my opinion that principle is really important and stays in the fundamentals of software design._In the context of the Single Responsibility Principle (SRP) we define a responsibility to be "a reason for change." If you can think of more than one motive for changing a class, then that class has more than one responsibility. This is sometimes hard to see._Read more about this principle here.

read more

The Open-Closed Principle

posted in Architecture on 2011-12-18   principle classes modules functions entities classes modules software entities classes called open closed robert c martin great article modification extension

That's a great article by Robert C. Martin. It's one of those articles that really may change something in your programming. The principle is called Open-Closed and it says:_SOFTWARE ENTITIES (CLASSES, MODULES, FUNCTIONS, ETC.) SHOULD BE OPEN FOR EXTENSION, BUT CLOSED FOR MODIFICATION._More about that here.

read more

AS3: Tracing in Flash/Flex

posted in ActionScript on 2011-08-16   import flash public str function debug movieclip void trace swf class

Inspired by the article of Dru Kepple I decided to share my experience in Debugging processes in flash/flex enviroment.

read more

AS3: Dealing with multi-language data in your application

posted in ActionScript on 2011-06-16   language storage key class text key string static storage addvalue http www site trace storage getvalue

I'm a big fen of the MVC pattern. I like the idea to store my data in one place and be able to get it fast. In most of my projects I used a class called Storage for similar purpose. It supports a multi-language data saving, so I decided to share it with you.

read more

AS3: runtime font loading (embedding)

posted in ActionScript on 2011-04-25   font field loader import flash swf public static const format font_export_name string font_file_name class

Flash is wonderful technology and has many advantages. Before a couple of years it was really popuplar to use it for displaying fonts that are not installed on the user's machine. Flash is still powerfull tool for such kind of tasks. These days I worked on a project which had to use a lot of fonts. It wasn't possible to embed all of them so I decided to implement runtime embedding.

read more

AS3: converting XML to JSON object

posted in ActionScript on 2011-04-02   label url image xml id img cdata node var version xml2json class http site int childnode object

I'm absolutely sure that you are using external data in your flash/flex applications. It is a good practice to transfer information in XML format. Most of the projects that I'm working on also use XML and in most of them I have a class that converts the data to JSON object. The problem with this workflow is that the parser's logic is always different because the XML is different. These days I wrote a class that solved this problem and directly converted every given XML file to a JSON object.

read more

OOP in JavaScript (part 2)

posted in JavaScript on 2011-02-22   child function parent prototype getname superclass parentclass childclass prototype extend child parent getname function return

I already wrote an article on this topic (Object Oriented Programming in JavaScript (Extending / Inherit classes)), but last few days I realized that there are some things that I didn't explain.

read more

Creating mp3 player with RobotLegs (basics tutorial)

posted in ActionScript on 2011-02-09   import public function event data preloaderevent robotlegs events class

Have you ever wondered how to optimize your ActionScript applications? Have you searched for a nice framework that will save you a lot of time and will organize your structure? If yes then RobotLegs is for you. In this article I'll show you how to use it to create a simple mp3 player which loads a configuration xml file, parse it and play mp3 files.

read more

AS3: Using custom metadata in flex (part 2)

posted in ActionScript on 2011-01-27   metadata public var data class string public var method metadataparser mycustomclass tag

Because of the huge interest in AS3: Using Custom Metadata in Flex (part 1) I decided to dig a little bit deeper in this topic. You already know how to get information about your custom metadata, so in this article I'll show you how to use it.

read more

JavaScript: managing events (dispatch, listen)

posted in JavaScript on 2011-01-06   function event events dispatch classname type eventbus addeventlistener testclass2 testclass1 var

As a huge fen of the flash platform, I always like to work with events. The events system in ActionScript3 is really helpful when we are building a big application with many modules and we want to keep them independent. JavaScript hasn't native support of events, but we can still use them.

read more

AS3: Using custom Metadata in Flex (part 1)

posted in ActionScript on 2010-12-28   metadata public flex mycustomclass information metadata tags tag as3 flash utils describetype public function mycustomclass

I'm sure that you've already used metadata tags in your flex applications. There are several reserved keywords like [Bindable], [Embed], [Event] and so on (the full list is available here). The function of the metadata tags is to provide additional information to the flex compiler. For example information about embeding assets, dispatching events. This article doesn't explain how to use the default flex tags (you can learn that from here). It shows you how to create your own metadata tags and how to use them.

read more

Object Oriented Programming in JavaScript (Extending / Inherit classes)

posted in JavaScript on 2010-12-23   function baseclass class childclass var getname subclass2 subclass1 extend

As you probably know JavaScript is not exactly OOP based language. Of course there are some ways to handle with this and you can still create classes and inherit them. It is much much better to use classes. Your application will be well structured and split to modules.

read more

How to generate SWC file from ActionScript package

posted in ActionScript on 2010-12-18   swc file classes output generated swc file compc exe usage

SWC file format is really useful when you want to transfer or to compact your ActionScript libraries. It is also used for exporting assets, which can be used later. Let's imagine that you want to create a .swc file for only small part of your application, i.e. pure .as files. I searched a lot for the fastest and easier solution and finally I think that the usage of compc.exe is the best option.

read more

Deep linking in flash with AS3

posted in ActionScript on 2010-11-14   flash page function hash address deeplinkingclass dl html swf home

Many people will say that Flash is not SEO friendly. Actually that's not 100% true. Flash is just a tool that shows your data. Exactly the same as the HTML. In this article I'll show you how to use ActionScript3 and JavaScript together to make your flash sites SEO friendly and provide a different URL for each of your pages.

read more