background preloader

OO

Facebook Twitter

JavaFX

Why Objective-C is cool. I've been asked to do an intro about Cocoa. So I thought about what would I tell people about Cocoa if I had some time. Sure I could throw up a quick tutorial on how to code a Cocoa app showing a bare minimum of how Objective-C works. But there are a million of tutorials like that and it doesn't really do the Cocoa justice. I want to give people an idea of why Cocoa or perhaps more specifically Objective-C is cool. I think anybody who has played computer games to some extent know how the game Doom (1993) from id software revolutionized gaming on the PC platform. Not very impressive. Why do I care so much about NeXT computers? To get an impression of how far ahead of its time Objective-C and what is now known as Cocoa was ahead of its time, consider this: In fact, with the superpower of NeXTSTEP, one of the earliest incarnations of DoomEd had Carmack in his office, me in my office, DoomEd running on both our computers and both of us editing one map together at the same time.

Background. The unknown acronym: GRASP. Every once in a while, I find a classic How to be a better programmer post with this mantra repeate in it by a young coder: That's good, and I'm always approving someone that takes the first steps of a personal kaizen and starts improving himself. However, I already tried to go againsta the tide with the How to be a worse programmer article. Today I'll talk instead of another acronym I never see in this type of posts: GRASP, which stands for General Responsibility Software Patterns (or Principles if you prefer).

GRASP is a collection of very high-level patterns (almost only ideas, concepts to keep in mind) for clean object-oriented programming. As such there will be no specific code here, but some principles to adhere. However, I'll include an example of application in each principle definition, since I do not like abstract-level talking about software. You'll see classes, objects and methods cited in every phrase. Creator Information Expert Unuseful getters are a classic mistake. Controller. Iliad Web Framework - Home. I am an Exception Extremist. Had a code review today and I realized that I am an exception extremist, an exception bigot if you will. I don’t like exceptions. I’d rather throw up than throw an exception. I have a rule, if you can detect the situation it’s not an exception and there are no exceptions to that rule. (Okay, there is one exception I blogged about earlier, but it makes the code so much cleaner.) Why I don’t like exceptions Most of the time the way you find out an API throws one (at least in C#), is when your code runs in production.

Of course I also hate when I am forced to handle and exception in Java using checked exceptions. One of the things I really don’t like about exceptions is that they break up the flow of the code. I also really don’t like that when I handle an exception I have to declare my variable above the try catch block so that I can use it after the block. Exceptions also lead us to bad code that gets written like: I don’t think I need to explain the above code more than it is already.

Java Pattern

Java. Exceptions and abstraction. August 14, 2010 – 11:30 pm Tags: Programming, Software design/architecture So you already know how to handle your errors properly. Even if you’re already using exceptions, there are some nuances to the use of exceptions that are important to know and understand in order to write code that is easier to reuse and more decoupled. Let’s talk about exceptions and how they relate to your classes and abstraction. Classes and abstraction? You might already know what I will be referring to when I talk about abstraction, but for the sake of this article let’s establish a base: Say you have a class for database access. These two classes abstract how you access these specific databases. Okay, so what do exceptions have to do with this? Your database classes throw exceptions when something goes wrong. Let’s add another class to the mix. Now our MySQL class is throwing MySQL exceptions.

But now you decide to use PostgreSQL and you must change all your code to catch PostgreExceptions. Conclusion Share this: Getting Started with Memcached Distributed Memory Caching. Wikipedia describes Memcached as a general-purpose distributed memory caching system, but what exactly does the term Memcached mean? Cache is memory used to store the most frequently used resources (e.g. browsers store every website visited during a session in cache), because accessing resources from a cache is faster than accessing them from a disk drive.

So Memcached means "memorycached," which simply is caching resources in the memory. These resources can be data retrieved from API calls, database operations or even HTML pages. The data is stored in key/value pairs in the form of large hash tables. As distributed system is part of the Memcached definition, you can install Memcached on various servers to make a larger caching server. How Does Memcached Work? Figure 1 will be familiar to anyone who has ever written a script that interacts with a database. Check whether the desired data exists in the cache. How to Install Memcached? Memcached -h The next step is to install Memcached.

C++

Refactoring. Why Java beats C++ and C# when you really want to be productive. I have programmed in a lot of languages over time and the one I always come back to when I want quick productivity, notice I did not necessarily say quick run time, is Java. Why would that be? First off you can just start typing your ideas and get the program running quickly. In C++ every time you write a few lines of code you have to think about writing the anti-lines too. Create it and clean it up. I have done a lot of code reviews. If I need to do a simple dialog box to say open a file, read in settings and allow a user to change settings and save them back I use C# / WinForms.

When you get into C# / WPF you are basically back in the Java world. C++ has a Dialog editor of course but it stinks when you need to resize and move controls about. The one huge issue that hits home once a project starts to grow in size is compile time speed. The C++ project takes 45 minutes to build. Java wins for being the most productive over the life of a product.