Tag Archives: OOP

JavaFX Tutorial for Dummies


JavaFX GUI (Graphical Interface) can be created in two ways: Without Scene Builder With Scene Builder In this tutorial we are going to create a very simple application window in eclipse without scene builder. Scene Builder is a software that supports drag n drop to build application GUI.

https://zahidhasan.wordpress.com/2014/09/14/javafx-tutorial-for-dummies/

Swift Protocols: A Strategy


via Swift Protocols: A Strategy | Big O Note-Taking.

So I’ve been drinking the Protocol-Oriented-Programming gatorade for a while now. I’ve taken it to the extreme a little: you won’t find a class in pretty much any of my code these days. So, before I pull it back a little, I thought I’d put down my strategy so far for how to handle these protocol things.

To give you an idea of where I’m coming from: I never really understood object-oriented programming. It never clicked with me. I mean, I know the basic ideas, but they were never internalised. On the other hand, functional programming was a breeze (by comparison). I should be clear: by FP I don’t really mean monads or functors or applicative functors and monoids and commands and arrows and lenses and flux capacitors. I think everyone has a relatively difficult time wrapping their heads around that stuff.

I mean the patterns you see in FP. Pure functions – of course – but other things, also. Things that aren’t strictly FP, but just tend to be found among the FP: type classes, currying, immutability, declarative-ness, laziness, higher-order functions. Contrast that to the patterns you find in OOP: the delegate pattern, class inheritance, single-dependancy whatnot (I can’t even name them because I’m sure I’m mixing up and misunderstanding them).

Now, there are probably good reasons why I understand FP a little easier than OOP (or I think I do). OOP was what I saw first: when I began coding, it was in OOP. By the time I tried to understand, say, higher-order functions, I had already gotten my head around functions, types, variables, etc. Whereas when I first read “Python is an object-orientedprogramming language”, I had written my first hello world a few weeks before.

On top of that, I’m a hobbyist – I don’t like making things that really work, because that’s annoying. I am very good at finding you Fibonacci numbers. I don’t need to know about state, or IO, so I’m perfectly fine in the clean, pleasant world of FP (or semi-FP).

So what about protocols, then? Well, now that you know what kind of person you’re listening to, it might make sense when I say this: protocols are awesome. They make so much sense. I can’t believe we were ever doing things any other way.

Are protocols FP? Kind of. The first implementation of something protocol-like was probably in Haskell, with type classes. But OOP had a very similar system soon after, in the form of generics. And Dave Abrahams, who works on Swift, was the main guy for templates in C++ for a long time. They’re not FP in the traditional sense, but they are FP in the sense that I understand it: they’re a certain kind of style/technique. And they fit right in with the rest of the styles and techniques of FP.

OOP Alternative to Utility Classes


via OOP Alternative to Utility Classes – Yegor Bugayenko.

A utility class (aka helper class) is a “structure” that has only static methods and encapsulates no state. StringUtils, IOUtils, FileUtils from Apache Commons; Iterables and Iterators from Guava, andFiles from JDK7 are perfect examples of utility classes.

This design idea is very popular in the Java world (as well as C#, Ruby, etc.) because utility classes provide common functionality used everywhere.

Here, we want to follow the DRY principle and avoid duplication. Therefore, we place common code blocks into utility classes and reuse them when necessary:

IMPORTANT JAVASCRIPT FUNDAMENTALS FOR OOP DEVELOPERS


via Important Javascript Fundamentals for OOP Developers : AppleGrew’s Mind.

In this guide I have tried to put together all important nuts and bolts of Javascript. I had a really hard time learning JS, since all these parts were scattered over the net. I gradually found them over the years. I hope I have covered all of them. Please let me know in the comments if you feel I missed something important or something is incorrect.

Irrespective of the title, this guide should be helpful to all developers. However, you should be familiar with basics of JS before this guide could be helpful. This is more of a collection of JS concepts.

Part 2: OOP in JS: Inheritance


via OOP in JS, Part 2 : Inheritance.

In Part 1 we saw how to create classes in JS, including private, privileged, and public properties and methods. This section discusses inheritance in Javascript.

Part 1: OOP in JS: Public/Private Variables and Methods


via OOP in JS, Part 1 : Public/Private Variables and Methods.

This page shows how to create private variables and methods in “classes” in Javascript through the rather simple example of a person. (This is really a very rough approximation of the classical OOP pattern, and not necessarily a “best-practice” for JavaScript programming.) Part 2 covers inheritance.

Google SoundScript: faster OOP for JavaScript


via Google SoundScript: faster OOP for JavaScript.

Google is currently working on SoundScript, a way to speed up object-oriented programming in JavaScript. The content of this blog post is completely based on a recent talk [1] by Dmitry Lomov. That is, everything I have written here is inferred from those slides and may or may not be correct.

Note: This blog post describes first ideas, avenues that Google is exploring for making JavaScript OOP faster. The final version of SoundScript may look and work completely different.