Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Object Oriented Orientation

by jdrago999 (Pilgrim)
on Aug 02, 2011 at 22:14 UTC ( [id://918146]=note: print w/replies, xml ) Need Help??


in reply to Object Oriented Orientation

Try Flash ActionScript 3

Really. It is similar to Java, yet will allow you to really get your OOP gears moving, *plus* because you can easily manipulate visual objects (boxes, bouncing red balls, whatever) you can actually *see* the results of your coding.

Re-learning how to do the exact same things you already know how to do in Perl, in another language can be boring at best and frustrating at worst. I recommend you learn another language that can help you build on what you already know. Build a Flash front-end to a Perl back-end, connecting the dots between the two via JSON. You'll do some learning and gain some skills in the process.

ActionScript 3 is quite similar to Java and C#, yet with the scripty feeling of JavaScript. Here is an example:

package com.vw { import flash.display.* import com.vw.*; import flash.events.*; import flash.utils.*; import flash.geom.Rectangle; public class MainScreen extends MovieClip { public var controls:MovieClip; public var viewPort:MovieClip; public var imageCanvas:MovieClip; public var navigator:MovieClip; public function MainScreen() { // Empty constructor: } public function init() :void { App.Trace(this + "::init()"); controls.init(); stage.align = StageAlign.TOP_LEFT; stage.addEventListener(Event.RESIZE, handle_resize); setTimeout(function():void { handle_resize(new Event("dummy_event")); imageCanvas.init(); navigator.init(); },1); controls.addEventListener("zoomLevel_changed", zoomLevel_changed +); } private function zoomLevel_changed(e:Event) :void { dispatchEvent(e); } private function handle_resize(e:Event) :void { App.Trace("stage.stageWidth: " + stage.stageWidth); viewPort.width = stage.stageWidth; viewPort.height = stage.stageHeight - controls.height; viewPort.y = 60; viewPort.x = (stage.stageWidth / 2) - (viewPort.width / 2); var orig:Object = { width: 900, height: 550 }; if( x > 0 ) x = 0; // Move the controls so that they are centered: controls.x = (stage.stageWidth / 2) - (controls.width / 2); if( controls.x < 0 ) controls.x = 0; // Move the navigator so that it is bottom-right justified: navigator.x = viewPort.width - navigator.width - 20; navigator.y = viewPort.height - navigator.height + controls.heig +ht - 20; // Move the log too: App.log.x = 20; App.log.y = viewPort.height - App.log.height + controls.height - + 20; dispatchEvent( new Event("resized")); } } }

Replies are listed 'Best First'.
Re^2: Object Oriented Orientation
by Anonymous Monk on Aug 03, 2011 at 14:59 UTC
    This might be sound advice ... in a suitable context ... but you are unwittingly taking for granted that the programmer is doing client-side scripting! Sure, one of the first decisions that you must make is "what tool(s) will I write this thing in?" And let the record show that programmers can write really-good or really-awful code in whatever tool they choose to pick up.

      This might be sound advice ... in a suitable context ... but you are unwittingly taking for granted that the programmer is doing client-side scripting!

      You're absolutely right. I am making an assumption as to the environment (server-side, client-side). That assumption may be incorrect.

      I understand that the OP is looking for advice on what language to learn so that they can better understand OOP in general. Classes, interfaces, overridden methods, public/private/static/protected members, inheritance, polymorphism, encapsulation, etc. Yes it's clear that Perl has all of those things (and then some) but what isn't always clear is how Perl's way (if there is such a thing) and the Java/C#/C++ way line up together. The keyword "private" for example is "my" in Perl (sort-of). Those other languages have keywords while Perl has idioms and other tricks to Get The Job Done.

      For someone who already understands OOP quite well, Perl's power can be magnified by a factor of magnitude. You could say the same thing for those who have a firm grasp of functional programming. Having previous experience with Perl may help the OP learn traditional OO practices in a language more closely-aligned to Java (such as ActionScript 3) because similar concepts -- though with different spellings -- can be detected in both.

      And let the record show that programmers can write really-good or really-awful code in whatever tool they choose to pick up.

      Aye. "That...is the sound of inevitability..."

        Classes, interfaces, overridden methods, public/private/static/protected members, inheritance, polymorphism, encapsulation, etc.

        Only two of those things are important to OOP, and arguably only one is vital.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://918146]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-24 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found