Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Pollyanna
Mar 5, 2005

Milk's on them.


brilliant!!!!

i can always port.

Adbot
ADBOT LOVES YOU

double sulk
Jul 2, 2010

gas (gay rear end Swinger)

double sulk
Jul 2, 2010

Socracheese posted:

if you want it to run fast do it in a c-lang

if you want to code it fast do it in ruby

Socracheese
Oct 20, 2008

Pollyanna posted:

what do you use classes for
last i tried to work with them it was a mess

i'll try to explain this in basic terms while sidestepping any sick 'pos ignorance burns

an easy example would be if you want to write a python thing dealing with 2d shapes, you might make a class called square which would contain a list of tuples which represent vertices that define where the square is, maybe even some variable that tells you what color it is. then there are class methods, i.e. functions that do something to your class object, so an example could be move_forward, and the function would manipulate ur vertices to "move" the square, like to move it up you might add some value to the y-components of the vertices.

in reality tho if you want to mess with 2d stuff in python you can use the python image library and it does a lot of the work for you

Socracheese fucked around with this message at 00:31 on Sep 26, 2013

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

do it in ruby motion and get the power of both!!!!

double sulk
Jul 2, 2010

USSMICHELLEBACHMAN posted:

do it in ruby motion and get the power of both!!!!

:getin:

Pollyanna
Mar 5, 2005

Milk's on them.


okay, that makes sense. i get that objects n methods are good for simulating irl circumstances but how does that translate to a broader programming perspective, like for example how would you use oop for abstract things like an IM client? what would a typical class be in that regard? something like class Message?

and yeah its prolly just that im inexperienced which is why i dont know what the gently caress

Socracheese posted:

i'll try to explain this in basic terms while sidestepping any sick 'pos ignorance burns

but those are funny

MrMoo
Sep 14, 2000

This is kind of entertaining, four developers are being pointed towards a two-day training on some visualisation toolkit, they have been provided with a list of questions and tasks to do before hand like write Fizz Buzz.

quote:

The Training is aimed for professional developers only.
e.g. Those that can answer the questions on the attached pdf.
Those that cannot should NOT attend.

Anybody that disrupts the training session, as determined by the trainer, will be asked to leave.

Additionally:
* Wifi/network access will not be provided.
* Mobile/Cell phones must be switched off during the training sessions. This is to ensure attendees focus on the training, and not performing other tasks (as has occurred in past training sessions).

MrMoo fucked around with this message at 03:07 on Sep 26, 2013

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

Pollyanna posted:

okay, that makes sense. i get that objects n methods are good for simulating irl circumstances but how does that translate to a broader programming perspective, like for example how would you use oop for abstract things like an IM client? what would a typical class be in that regard? something like class Message?

and yeah its prolly just that im inexperienced which is why i dont know what the gently caress


but those are funny

sure. let's look at an im client. say it has a class Window, which represents an open chat window. Let's give it a TextInputField, a Scrollbar, and a list of Messages. The Messages have an author and some text for the actual message...

basically, the idea is that you break things down into natural components, and nest them inside each other, so that you can more easily abstract what's going on. the ConversationDisplay doesn't really know anything about what's going on inside the Messages; all it does is ask them how much space they need & then position them accordingly. likewise, the Messages don't know what they're being used for; for all they know, they could be displayed in a corner-of-the-screen notification bubble. everything is split up to be as simple as possible so you don't have to worry how everything combines with everything else; each class only has to deal with its own area of concern.

classes are, in the end, a tool for making programs easier to understand.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
Pollyana if you're already comfortable with the basic python stuff (lists, tuples, dictionaries, opening a file idk) take a look at this course. Peter Norvig, the guy who teaches it, seems to be more of a functional programming kind of person and doesn't really like using classes regularly. imo this is the right approach with python.

if you're insecure about python basics then check the mentioned cs101, I never watched it but I hear it's good. if you're into reading books check Think Python. I first learned python with that and it's p good.

if you REALLY like oop, WHOA CLASSES AND STUFF then go learn ruby (if you don't care). but actually going with java would probably be the non-joke path to go but don't ask me about that, idk poo poo about java.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
I don't wanna be a p-langer forever and I plan to learn me some C# but I have absolutely no immediate thing to do with it at the moment so I'm still masturbating my mind with some bullshit

Nomnom Cookie
Aug 30, 2009



Pollyanna posted:

what languages are most popular for employers

java? c++? objc?

and also i have a python thing and i want to give it a gui hence python guis

Java is for server jobs and Obj-C is for iOS jobs. They're both popular, so what matters the most is what kind of job you'd rather be doing.

Pollyanna
Mar 5, 2005

Milk's on them.


Nomnom Cookie posted:

Java is for server jobs and Obj-C is for iOS jobs. They're both popular, so what matters the most is what kind of job you'd rather be doing.

iOs jobs for sure. it's a pun too.

Symbolic Butt posted:

I don't wanna be a p-langer forever and I plan to learn me some C# but I have absolutely no immediate thing to do with it at the moment so I'm still masturbating my mind with some bullshit

what does p-lang mean in this context. i thought it was just "programming language"?

Symbolic Butt posted:

Pollyana if you're already comfortable with the basic python stuff (lists, tuples, dictionaries, opening a file idk) take a look at this course. Peter Norvig, the guy who teaches it, seems to be more of a functional programming kind of person and doesn't really like using classes regularly. imo this is the right approach with python.

if you're insecure about python basics then check the mentioned cs101, I never watched it but I hear it's good. if you're into reading books check Think Python. I first learned python with that and it's p good.

if you REALLY like oop, WHOA CLASSES AND STUFF then go learn ruby (if you don't care). but actually going with java would probably be the non-joke path to go but don't ask me about that, idk poo poo about java.

i'm confident that i know the basics of Python, at least with regards to functional programming. and yeah python always seemed like more of a scripting language like MATLAB or something.

i don't know why, but i don't like java

PleasingFungus posted:

sure. let's look at an im client. say it has a class Window, which represents an open chat window. Let's give it a TextInputField, a Scrollbar, and a list of Messages. The Messages have an author and some text for the actual message...

basically, the idea is that you break things down into natural components, and nest them inside each other, so that you can more easily abstract what's going on. the ConversationDisplay doesn't really know anything about what's going on inside the Messages; all it does is ask them how much space they need & then position them accordingly. likewise, the Messages don't know what they're being used for; for all they know, they could be displayed in a corner-of-the-screen notification bubble. everything is split up to be as simple as possible so you don't have to worry how everything combines with everything else; each class only has to deal with its own area of concern.

classes are, in the end, a tool for making programs easier to understand.

it seems like this really works best when you're thinking of a typical application, like notepad or aim or chrome. something you can visualize and will eventually "have a look". the approach makes sense if you're making an im client, but it doesn't quite make as much sense if you're writing a web scraper or working with databases or something. that's kinda why i'm starting to look at gui stuff, python is good for the basic logic behind my stock analysis program but extending the functionality (i.e. making it a real app) is i feel better suited to a different language.

weird
Jun 4, 2012

by zen death robot

Pollyanna posted:

what does p-lang mean in this context. i thought it was just "programming language"?

its u

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Pollyanna posted:

it seems like this really works best when you're thinking of a typical application, like notepad or aim or chrome. something you can visualize and will eventually "have a look". the approach makes sense if you're making an im client, but it doesn't quite make as much sense if you're writing a web scraper or working with databases or something. that's kinda why i'm starting to look at gui stuff, python is good for the basic logic behind my stock analysis program but extending the functionality (i.e. making it a real app) is i feel better suited to a different language.

definitely not. classes are a great way to break down the logic in any problem.

think about like, a directory tree. I can have a class, File, and then a subclass of File called Directory (in this case, making directory inherit from File makes sense, because it really is a special case of File. in many cases you will use class composition instead of inheritance). The initialize method on Directory can call a method that searches for subfiles/directories within that dir, initialize them, and add them to an instance variable called file_array.

every time a new directory gets initialized, it will check for its own subdirs/files within itself, and automatically initialize them. now you have a recursive data structure without needing to write a recursive loop, all you have to do is initialize the top directory.


or if you're writing a pathfinding algorithm, it makes a lot of sense to have a class called "node" that represents one of the branches in a path. The node will ivars with pointers to its parent/child nodes.

of course any problem can be solved without classes, it just makes many things way easier. if you're doing something like, writing a video encoder, you might have a couple of classes, say for something like a Frame, but i'd imagine it mostly comes down to lots and lots of computations.

DONT THREAD ON ME fucked around with this message at 01:51 on Sep 26, 2013

Nomnom Cookie
Aug 30, 2009



Pollyanna posted:

iOs jobs for sure. it's a pun too.

There you go. Time to start cranking out apps. Either you'll get a job on the strength of your portfolio or you'll start supporting yourself off your apps.

Pollyanna posted:

what does p-lang mean in this context. i thought it was just "programming language"?

PHP Python Perl Ruby

Pollyanna posted:

i don't know why, but i don't like java

I didn't like Java either until I started using it at work and learning the tools & libraries. Still, these isn't much point in using Java unless you're interested in systems programming.

Pollyanna posted:

it seems like this really works best when you're thinking of a typical application, like notepad or aim or chrome. something you can visualize and will eventually "have a look". the approach makes sense if you're making an im client, but it doesn't quite make as much sense if you're writing a web scraper or working with databases or something. that's kinda why i'm starting to look at gui stuff, python is good for the basic logic behind my stock analysis program but extending the functionality (i.e. making it a real app) is i feel better suited to a different language.

OOP is about clumping together code and data in ways that make sense. Sometimes the clumps are obvious like Window and Button objects in a GUI, sometimes they're more abstract like a scraper task that hands off pages to the DB task. There are some cases where OOP doesn't make sense but they aren't as common as newbies think. Or just do like the last guy to work on my current project and hide your procedural code in static methods on a separate class.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
the thing with oop in python is that unless you're working with some kinds of stuff (web frameworks, guis) 90% of the time classes are way overkill. you already got modules, named tuples, function attributes, duck typing and whatever else. also, it always left me a strange impression how most introductory python courses seem to talk about classes last and it sounds so unnatural and... theoretical wishful thinking?

I think I only got a good feel for oop when I messed around with ruby making a tetris game and it finally clicked with me how all the mumbojumbo makes sense in a language where oop is the main idiom. but idk, I'm a scrub.

Pollyanna posted:

what does p-lang mean in this context. i thought it was just "programming language"?

definitive yospos consensus on p-langs are: Php, Python, Perl and Ruby

those are pretty much all the slow and useless scripting languages. real programming heroes like Ulillillia use C.

and lua and javascript are honorary p-langs I guess? the pl thread needs some serious discussion on this convention.

JewKiller 3000
Nov 28, 2006

by Lowtax
OOP is about subtyping and dynamic dispatch, you don't even need classes to do it. but people have been taught "OOP = everything good" so they think it subsumes all modularity and polymorphism

also javascript is definitely a p-lang.

JewKiller 3000
Nov 28, 2006

by Lowtax
a p-lang is a language that pretends to be object-oriented, but has implemented "object" as "mutable hash map of string keys to arbitrary (possibly functional) runtime values, plus a pointer to a parent hash map"

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
javascript is too bad to be a p-lang

and lua is too uh, idk it's like no one programs just in lua it's always an extension of some other thing which makes it less of a plang

Notorious b.s.d.
Jan 25, 2003

by Reene

JewKiller 3000 posted:

a p-lang is a language that pretends to be object-oriented, but has implemented "object" as "mutable hash map of string keys to arbitrary (possibly functional) runtime values, plus a pointer to a parent hash map"

for all the things i hate about perl and ruby this is not a core problem, both have real OO systems available

(php, hosed if i know. i had bigger fish to fry than oo purity)

Bloody
Mar 3, 2013

lua is too scriptlang to be a plang nobody confuses it for a real lang which seems to happen all the fuckin time with php/python/ruby/js

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
yeah lua is not useful enough to be a plang

Bloody
Mar 3, 2013

USSMICHELLEBACHMAN posted:

yeah lua is not useful enough to be a plang

this implies plangs are useful. i would've gone with "lua is too well-scoped to be a plang"

double sulk
Jul 2, 2010

the only good thing python has is its itertools lib

double sulk
Jul 2, 2010

being python-inspired is half the reason golang is unenjoyable to use because python syntax is loving ugly

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
someone needs to write a fast ruby

double sulk
Jul 2, 2010

USSMICHELLEBACHMAN posted:

someone needs to write a fast ruby

there is one, it's called ruby 2.0

Nomnom Cookie
Aug 30, 2009



Notorious b.s.d. posted:

for all the things i hate about perl and ruby this is not a core problem, both have real OO systems available

(php, hosed if i know. i had bigger fish to fry than oo purity)

Perl has bless. PHP apes Java.

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off
sulk rackin' up the wrongposts like there's no tomorrow

JewKiller 3000
Nov 28, 2006

by Lowtax
maybe i can give a better description

p-langs take OOP, remove the static type system that makes complex subtyping tolerable and optimizable, and they enable mutability of just about anything at runtime, from adding/removing methods to changing the subtype hierarchy. the p-lang programming model is to write incomprehensible spaghetti dynamic dispatch code, and whenever you run into a problem, generate more of that code at runtime

any gains that are possible from OOP are far outweighed by the negatives introduced by p-langs

double sulk
Jul 2, 2010

PleasingFungus posted:

sulk rackin' up the wrongposts like there's no tomorrow

if being nil is wrong then i don't wanna be right

JewKiller 3000
Nov 28, 2006

by Lowtax
having nil is wrong unless nil has type alpha option and the alternative is a non-nil-tagged value of type alpha

double sulk
Jul 2, 2010

JewKiller 3000 posted:

maybe i can give a better description

p-langs take OOP, remove the static type system that makes complex subtyping tolerable and optimizable, and they enable mutability of just about anything at runtime, from adding/removing methods to changing the subtype hierarchy. the p-lang programming model is to write incomprehensible spaghetti dynamic dispatch code, and whenever you run into a problem, generate more of that code at runtime

any gains that are possible from OOP are far outweighed by the negatives introduced by p-langs

if you're writing poor dynamic language code, that's on you for either writing poor tests and/or poor implementation outright.

Nomnom Cookie
Aug 30, 2009



You just said that bad code is the programmer's fault. No poo poo, Sherlock.

JewKiller 3000
Nov 28, 2006

by Lowtax

gucci void main posted:

if you're writing poor dynamic language code, that's on you for either writing poor tests and/or poor implementation outright.

no it isn't because dynamic languages remove perfectly good type checks for no acceptable reason. i shouldn't have to write those tests (of course i should write tests, just not for things that the compiler can easily check for me, if i would only give up my bad habits of writing in p-langs)

seriously if you're going to write good code, then use a good programming language. there are two reasons to use a bad one: (1) your boss or the technical situation absolutely requires it, or (2) you are a bad programmer and you want a language that will accept your obviously incorrect programs on the condition that you never actually execute the parts that are wrong

Nomnom Cookie
Aug 30, 2009



Doesn't GHC have a "gently caress the type system and make it compile" option? It's the best of both worlds.

double sulk
Jul 2, 2010

lol haskell

Shaggar
Apr 26, 2006
tbh I wouldn't call javascript a p-lang unless you're doing something stupid like node.js or super heavy client side stuff. some javascript to validate a form is fine. obviously pre-compiled bytecode from a better language would be optimal, but as long as you aren't trying to write applications in it then whatever.

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax
if you are actually constrained by a modern type system to the extent that you really cannot write the code you need to write, there will almost certainly be a magic cast you can use for such rare esoteric situations

what you shouldn't do is say "gently caress type systems, i'm coding in python from now on"

  • Locked thread