OO Programming

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 1417 Views - Last Post: 04 August 2012 - 09:00 PM Rate Topic: -----

#16 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1359
  • View blog
  • Posts: 3,425
  • Joined: 28-November 09

Re: OO Programming

Posted 03 August 2012 - 08:31 PM

What your doing should remain true to the principals KISS(keep it simple stupid) and DRY(don't repeat yourself.) If a class is not necessary to print something, then don't implement a class. Likewise if a structured data type is necessary for the readability and stability of the program, get to it and don't try and hack together anonymous functions.

There's a time and place for every type of paradigm or practice, and what makes a great programmer is knowing when and where that is exactly. For instance, I wouldn't use Python for a low level program that needs max efficiency, and I wouldn't use C for a program that was a quick fire script.
Was This Post Helpful? 0
  • +
  • -

#17 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: OO Programming

Posted 03 August 2012 - 10:13 PM

View Postjon.kiparsky, on 03 August 2012 - 04:13 PM, said:

I do agree with you that java is not what I'd go to for trivial cases. Python is definitely better suited to stuff you don't want to maintain. In that way it seems to be more of a post-perl than an anti-java.

EDIT:Okay, I admit I'm baiting a little here - but with a purpose. The complaints about the Java boilerplate, which are not unique to the pythrong, seem to me to reveal more of a hostility to Java as a language than an understanding of the real differences between the languages. For the record, I agree with what dogstopper actually meant, in addition to the parody of what he said.


I realized you were baiting and chose to not take it. I pandered several times essentially saying "I have no qualms with Java." Java was my first language and will forever hold a dear place inside my heart. Like any tool, there's a time and place for it. I love using Java when I can benefit from Swing, and I love using Python when I can get it done fast, simple, and clean. Also, I have no difficulty maintaining and scaling good Python code.

This post has been edited by atraub: 03 August 2012 - 10:36 PM

Was This Post Helpful? 0
  • +
  • -

#18 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1359
  • View blog
  • Posts: 3,425
  • Joined: 28-November 09

Re: OO Programming

Posted 04 August 2012 - 12:50 AM

I work with 900+ wireless antennas. I have no intention of making a class and instantiating them all through that when I can just make anonymous methods on the fly and have things up and running.

Perl Python Ruby are meant for scripting primarily.

Java C# are meant for developing applications and larger programs.
Was This Post Helpful? 0
  • +
  • -

#19 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5800
  • View blog
  • Posts: 12,636
  • Joined: 16-October 07

Re: OO Programming

Posted 04 August 2012 - 04:56 AM

*
POPULAR

View PostLemur, on 04 August 2012 - 03:50 AM, said:

Perl Python Ruby are meant for scripting primarily.


I don't know that I would agree with this.

Perl, yes, it's better than shell scripts, but... At the same time, people have written giant web thingies with it. There are large applications in perl.

Ruby... Rails raised it up and then raised it to the ground, I think. Anyway, I never bothered with it for much more than play. Doubtless, you could do a large project in it.

Python is NOT primarily a scripting language. It is, effectively, the VB6 of Linux. ;) It can, and does, glue all the libraries of the environment together in an approachable, easy to use, wrapper. Yes, it's excellent for scripting. However, it has the proper elements for larger projects.

You can create code modules in a trivial way. Effectively organize code and build large programs. Is it still duck typed? Yep. Then it's up to the test harness to make sure everything works, not the compiler. You should have a test harness anyway.

Now, to OO... Well, it's really not the strong typed, classes or die, kind of OO that you find in Java. It doesn't even have real code hiding or function security. But then, Python trusts it's users. You can get real worked up about OMG Classes. Python frees you from that.

I have some code that pulls an employee record from the database. The C# version has a class to hold that data, or at the very least a typed dataset with data adpters, etc. The Python version will give you the same data row as a list or a dict. A collection of rows as a list. It will trust that you know what to do with that; there is no imposition of order to protect you from you. It is a different sensibility. Both sides can go too far; balance is good.
Was This Post Helpful? 5
  • +
  • -

#20 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7644
  • View blog
  • Posts: 12,890
  • Joined: 19-March 11

Re: OO Programming

Posted 04 August 2012 - 06:36 AM

baavgai, the taoist programmer. Can we get a book of koans from you? That would be awesome.

Yes, this is very much where I stand on things. There are benefits to each approach, and the interesting thing is to find the ways to make use of one and the other. Finding fault with the other guy is sort of tedious and pointless, because it tends to circle around a few fixed points of criticism, which we are all familiar with, and it doesn't tend to illuminate much of interest.
Comparison of languages can be interesting, whinging about some bad-guy language's idiosyncracies can never be interesting.
Was This Post Helpful? 0
  • +
  • -

#21 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: OO Programming

Posted 04 August 2012 - 08:26 AM

View Postjon.kiparsky, on 04 August 2012 - 09:36 AM, said:

...Finding fault with the other guy is sort of tedious and pointless...

...whinging about some bad-guy language's idiosyncracies can never be interesting.


No... just no. No one did this in this thread. No one is "whinging". No one is trying to "find fault with the other guy". I don't know where you're getting this from, but you need to stop, now.

This post has been edited by atraub: 04 August 2012 - 09:11 AM

Was This Post Helpful? 0
  • +
  • -

#22 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7644
  • View blog
  • Posts: 12,890
  • Joined: 19-March 11

Re: OO Programming

Posted 04 August 2012 - 03:24 PM

I was speaking more generally about the python community as a whole, which engages in this practice constantly - just as other language communities, like clojure do.

This post has been edited by atraub: 05 August 2012 - 03:16 PM
Reason for edit:: FTFY

Was This Post Helpful? 0
  • +
  • -

#23 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1359
  • View blog
  • Posts: 3,425
  • Joined: 28-November 09

Re: OO Programming

Posted 04 August 2012 - 09:00 PM

View Postbaavgai, on 04 August 2012 - 06:56 AM, said:

View PostLemur, on 04 August 2012 - 03:50 AM, said:

Perl Python Ruby are meant for scripting primarily.


I don't know that I would agree with this.

Perl, yes, it's better than shell scripts, but... At the same time, people have written giant web thingies with it. There are large applications in perl.

Ruby... Rails raised it up and then raised it to the ground, I think. Anyway, I never bothered with it for much more than play. Doubtless, you could do a large project in it.

Python is NOT primarily a scripting language. It is, effectively, the VB6 of Linux. ;)


Snipped a bit. I suppose that was a bit hasty to refer to it as such. At $WORK I use Ruby almost exclusively for scripting and automation frameworks, and at ~ I try and use python to duplicate what I did at $WORK. I see them as near interchangeable, but syntax wise I prefer Ruby.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2