Posts
Coffeescript Model class with attr_accessor rails alike
Nowadays Iāve been toying around with the fabolous coffeescript language and Iāve created a basic model class.
This class allow you to use attr_accessor method as you can do in Ruby. If you donāt know what attr_accessor is you can take a look here: Ruby attr_accessor.
Briefly what attr_accessor does is to let you access object attributes in āobject.attributeā form (which in javascript is built in) but more importantly let you add a constrain on read/write permission of that attribute! In fact if you want the attribute to be readonly you need to use the āattr_readerā method, in the opposite case you need to use the āattr_writerā method. If you donāt want to add any constraint you can use the āattr_accessorā.Strong Typing vs Duck Typing PHP, C#, Ruby
If you have heard of strong and weak typing but doesnāt know the main difference and advantages/disadvantages of both the paradigms in this article Iāll try to help you having a better undestanding of the overall concept. The first thing you need to understand is what types are. When you save some data in the memory you can associate to that space of memory a data-type, by associating a type you can have different behavior when manipulating that piece of data. In an object orientet language generally there are two main categories of data:
The best shell for progamming: oh my zsh
Hello guys, itās been years that iām using bash as my preferred shell. Recently iāve found a cool tool that you should try, itās called: oh my zsh. Whatās that? Itās zsh: basically bash with some more features and also have cool plugins made by develpers that you can enable to have easier time progamming in your preferred language. There are more then 150 plugins and you should definatelly take a look at that! the install is also really easy, for example hereās the command to run on MacOSX ācurl -L http://install.ohmyz.sh | shā and youāre done!
Test double php introduction
When you start unit testing your code you donāt want to test a full behavior of your code but just a little part in isolation to the rest. In order do do that you need to isolate your class from the other context, test doubles are tools (aka patterns) that allow you to do that. There are five common test double:
PHP: why and when static is evil
Hello guys, many pepole asked me in various situation if they should use static in their code, for this reason i decided to briefly explain why static is generally a bad choiceh and in which cases you can use it. Before explaining you when and when not to use static you need to know the difference between static and istance variables. The difference is that with a static variable his value will remain the same for the full execution of the process, anytime you access it. With an instance variable instead that values is binded to the instance of the class (the object!) and can be different for every new istance of the class. Letās make and example:
subscribe via RSS