In the last few days I've seen somey very interesting links what I'd like to share.
Badass JS is an interesting concept, showcasing the capabilities of the language
http://badassjs.com/
JS1K is similiar, but it's more like a competition than a blog. If you can do something interesting <1K in JS, then share it! (Funny, but this actually reminds me for C style competitions though)
http://js1k.com/
Derek Siver's entry about learning JS
It's a brief view of the best books available considering JS.
http://sivers.org/learn-js
Learning with Spaced Repetition
From Siver's entry, we can get to here, this is a very exciting learning method. I think the Quantified Self concept is intriguing too.
http://quantifiedself.com/2012/06/spaced-repetition-and-learning/
RED language
RED is a nice concept whereas this one slide catched my eye (click).
It actually says what I think; every language is good for a specific task. (But RED will be a universal solution?). Reach the full slide here.
Have a nice Easter!
Image from http://greatinspire.com/happy-easter-2012/
Easter links
Labels:
badassjs
,
easter
,
javascript
,
js1k
,
learning
,
links
,
quantified
,
red
,
self
,
spaced repetition
With or without an IDE?
I've been working on JavaScript projects for 2 years now, and in the beginning, I found it very frustrating to work without a proper IDE, as I came from the C# (.NET) world. But things have changed (?).
Your IDEas?
One can say working with C# (or VB, whatever) in Visual Studio is like a dream. You can find the references of nearly anything, refactor and debug your code easily, in addition there is IntelliSense. This tool is a very strong factor when it comes to development. A few years ago I gave speeches and presentations about C#, .NET, and Visual Studio, and I started my programming career with C# so I can say I like this world.

But things have changed, and nowadays I write a lot of JavaScript code on a daily basis. I use Eclipse now, nothing really fancy. This is a really nice open-source environment, though it's not as good as Visual Studio. Moreover, when it comes to JS it's not so strong at all.
However, this situation has more pros than cons for me. I started to realize when I don't have a really clear view of my "classes" because Outline view starts to fail, or can't see a variable's value just a few clicks away, I start to think about my code. I analyze it, think about it, and critisize it.
"This class shouldn't be so huge. I can't manage it very well."
"I can't see the role here, should I put these into separate files?"
"This variable name isn't good."
So I reckon that I write more manageable code when I don't have such a good support with my IDE, because I can't see through my classes/functions if they are too big. Moreover, I can't debug so easily so I pay more attention on naming things, especially on variables, thus I write cleaner code.
This post is not about why I don't use NetBeans (which is evolved to a nice tool for a HTML5 dev.) or Aptana Studio (though this one has some serious performance issues I think). It's more likely about why I don't feel the need, and why I can understand hardcore emacs/vi/vim guys.
You have to face it!

In regards to JavaScript there will be a point when you’ll have to face the lack of your IDE, and that time will come fast. Maybe you have a full support for native JavaScript expressions (however some anonymous functions will be enough to confuse any IDE, not to mention the module pattern), or jQuery but when one will start to use other libraries like underscore or BackBone, no IDE will provide any good help.
Okay, the situation is not that bad, because these libraries generally have clear and nice API documentations, but all in all you'll have to give up some of your comfort when you want to write JS codes.
p.s.: If you are wondering about the second picture: that was the first match on Google Search for Eclipse... :)
Labels:
development
,
eclipse
,
ide
,
javascript
,
native javascript
,
studio
,
visual
A note on semantics
The (JavaScript/single screen) project that I work on recently has some serious maintainability issues -especially when it comes to functions- and that indicated a few thoughts of mine around the topic. The inspiration came from the Maintainable JavaScript book by Zakas (which is quite good!), and from my keen interest in writing simple, clean, sustainable code.
The first bad pattern what I have seen in this project:
If I call a function like createWidget I somehow think about that is a function which creates a widget on the page... and, that's all! It shouldn't contain any type of business logic, especially not of a type those contain logic about page processing! Because what happened is that function called from a context which already calculated the validation logic, besides that it fired an event that somehow called the caller function again, and there is our infinite loop...
The problem was not that I had to fix an infinite loop, but why. Because of the semantical problem. Why you make a function public which contains processing logic (so that's function is almost not a function just a reducated step of a bunch of processing lines). But if I go in deeply: why you have any kind of business logic (like validation and firing uncorrelated events), when you name a function like createWidget? It shouldn't have any side effects with that name..
The point is about what makes a programmer. If you can learn a programming language, that's good for starters, but if you see the bigger picture, you can see that it's just the top of the mountain. Programming is not about loops, conditions, classes, namespaces or statements, moreover it's about roles, responsibilites, separation and building separate -as dumb as they can- components. If you can't see what is the role of a function, or a class, or which are the burden of a component in your code then you can write spagetthi code anyways.
The first bad pattern what I have seen in this project:
name.space.classA = (function(){
function init () {...}
function createWidget() {...}
...
return {
createWidget : createWidget
}
})();
createWidget() was a kind of page processing function (which was called in init()). The big problem was there that createWidget() had code which was necessary for page loading, say it contained validation logic. Then it got exported to the public without thinking... and there is the big lie. Nobody will stop you to do that, neither in strongly typed (OOP) languages, nor in JavaScript. It's called semantical problem. Because if you export any type of function to the public, you must think about what that function does and how, and especially you have to name it right.If I call a function like createWidget I somehow think about that is a function which creates a widget on the page... and, that's all! It shouldn't contain any type of business logic, especially not of a type those contain logic about page processing! Because what happened is that function called from a context which already calculated the validation logic, besides that it fired an event that somehow called the caller function again, and there is our infinite loop...
The problem was not that I had to fix an infinite loop, but why. Because of the semantical problem. Why you make a function public which contains processing logic (so that's function is almost not a function just a reducated step of a bunch of processing lines). But if I go in deeply: why you have any kind of business logic (like validation and firing uncorrelated events), when you name a function like createWidget? It shouldn't have any side effects with that name..
The point is about what makes a programmer. If you can learn a programming language, that's good for starters, but if you see the bigger picture, you can see that it's just the top of the mountain. Programming is not about loops, conditions, classes, namespaces or statements, moreover it's about roles, responsibilites, separation and building separate -as dumb as they can- components. If you can't see what is the role of a function, or a class, or which are the burden of a component in your code then you can write spagetthi code anyways.
Labels:
bad patterns
,
functions
,
maintainable code
,
side effects
,
spaghetti code
The beginning
Hey,
I'm Jozsef, a web developer currently located at Budapest, Hungary. I start this blog to write my thoughts about development, front end development, dev. in general, life, food, health, whatever.
Besides that, this blog also has another big goal; I try to practice English through writing these sentences. I can't promise it won't contain errors, so fixes are welcomed. I'm a type of visual learner, so I like to think in images and maps, so I'll try to express some key points of mine through images. The bad news about that authoring a blog with images takes a lot of time. So I’m not sure I'll be able to hold to that promise.
I find lean thinking so exciting that I always try to apply it in real life. So I'll be keen to express myself as lean as possible. I always try to take the fewest steps to reach goals and solutions. So be prepared! :)
I'm Jozsef, a web developer currently located at Budapest, Hungary. I start this blog to write my thoughts about development, front end development, dev. in general, life, food, health, whatever.
Besides that, this blog also has another big goal; I try to practice English through writing these sentences. I can't promise it won't contain errors, so fixes are welcomed. I'm a type of visual learner, so I like to think in images and maps, so I'll try to express some key points of mine through images. The bad news about that authoring a blog with images takes a lot of time. So I’m not sure I'll be able to hold to that promise.
I find lean thinking so exciting that I always try to apply it in real life. So I'll be keen to express myself as lean as possible. I always try to take the fewest steps to reach goals and solutions. So be prepared! :)
Labels:
development
,
introduction
,
lean
,
visual
,
web
Subscribe to:
Comments
(
Atom
)

