PDA

View Full Version : Linux Programming



syntheticz
December 9th, 2007, 10:39 PM
I am a total beginner in linux and I know NOTHING about any kind of programming, I read the stickys but they do not seem to cover what I need. What programs/things will I need to start?
Where can I learn open source?

Any advice or help would be greatly appreciated.

Thanks

rufius
December 9th, 2007, 11:22 PM
Well what kind of programming are you looking at doing? Do you want to develop GUI applications or work on back end libraries and such?

Look into python and wxGlade if you're wanting to build GUI applications. Python is a good all around starter language and is quite common on most systems. You can find python tutorials everywhere but my suggestion is start at the official python tutorial (http://docs.python.org/tut/).

If you're feeling adventurous you can always learn C. If you go that route, you should read K&R, that is The C Programming Language by Kernighan & Ritchie. After that, you'll want to go to The Unix Programming Environment - Kernighan & Pike. Those are both excellent books on C and get you right into the middle of things.

pmasiar
December 9th, 2007, 11:49 PM
Don't start with C unless you have a guru around to help you. Python is much simpler to learn. Wiki in my sig has links to free online resources and training tasks.

Also, don't bother with GUI untill you learn plan commandline first. Then decide what you want to learn, find a project which does that, and join. You need to be prepared to learn a lot by yourself, google is your friend, many people walked same path before you and there are loads of info available, if you are ready to learn.

MicahCarrick
December 10th, 2007, 01:49 AM
I agree that Python might be a good language to start with, although C and/or C++ is something you should consider down the road once you master the fundamental programming concepts.

As for what you need, in Linux, most things are already at your disposal as far as software in concerned. A text editor such as GNOME's default editor Gedit and a terminal window (or teminal plugin for Gedit) will get you started.

Then, you'll need some time, some patience, and a good tutorial or 10.

pedrotuga
December 10th, 2007, 05:48 AM
I recomend PHP as it is the most simple language i've ever seen.

tyoc
December 10th, 2007, 05:59 AM
C unless you have a guru around to help you
Or a good book or reference, and enough of attitude/aptitude for learn it by yourself.

rufius
December 10th, 2007, 07:12 AM
Or a good book or reference, and enough of attitude/aptitude for learn it by yourself.

I agree, I learned C as a first language and had my trusty (and dusty) copy of K&R with me at all times at the computer. Yes its painful but if you learn C first you appreciate what you get later in languages like python, ruby, and so on.

Just my thoughts, but for the OP, I think python is a good jumping off point.

Vox754
December 10th, 2007, 08:03 AM
I am a total beginner in linux and I know NOTHING about any kind of programming, I read the stickys but they do not seem to cover what I need. What programs/things will I need to start?
Where can I learn open source?

Any advice or help would be greatly appreciated.

Thanks
What do you need?

Frankly, I find it very hard to advice someone who is a total beginner in Linux. I ask myself, "why would a total beginner want to program anything?".

My single advice would be to learn your operating system before you try to do anything else.

Or maybe you could provide a better background of yourself.
Are you a kid? Are you starting college? What do you want to do? Do you want to program for a living? Will you consider it a hobby? Games, web applications, desktop applications?

Programming is not for everybody: you need to be clever.
There are a number of questions like yours every week, and some people simply don't have what it takes to be a programmer because they always want an easy way, like there is some magical formula to turn you into a good programmer with little effort.
Actually, Python is great in this aspect, however there are still people who refuse to read manuals to solve even the most basic problems.

This is not a criticism to you, but I find it very constructive to read this article "How to ask questions the smart way" (http://catb.org/~esr/faqs/smart-questions.html), so you try to understand how real hackers think when they discuss technical issues.

pmasiar
December 10th, 2007, 02:19 PM
I recomend PHP as it is the most simple language i've ever seen.

It is not obvious from your comment: What kind of experience you have?

I know both PHP (enough not to use it) and Python, and commandline Python is **much** simpler for beginner.

@OP: Be careful how to understand advice from random people. Some people know some basics, but don't have enough experience to put own experience into a wider context, so they advise what what might be good for them, not for you.

LaRoza
December 10th, 2007, 03:10 PM
I also recommend Python as a first language, but I looked in the stickies also, and found this: http://laroza.pbwiki.com/

kvorion
December 10th, 2007, 08:47 PM
I would rather suggest you start exploring the Linux operating system first.

Python or C would be a good language to start programming in, although a lot depends upon why exactly do you want to program. There are a lot of Python supporters here, but I would still say that C can also be a good first language.

syntheticz
April 2nd, 2008, 07:25 PM
I have just started college (UK), I plan to do it as a hobby and hope to contribute something useful to the open source world. My maths is not very good but from what people tell me, computing does not require a great deal of mathematical skill.

Yes I would like to get to know the OS first. The terminal really scares me, when I type things in it either does not do anything or comes up with a lot of technical stuff that I do not understand, then again I suppose Linux embodies what computing is supposed to be like, but most of us are just used to Microsoft's do everything for you but poorly approach and rip you off in the process.

LaRoza
April 2nd, 2008, 07:36 PM
I have just started college (UK), I plan to do it as a hobby and hope to contribute something useful to the open source world. My maths is not very good but from what people tell me, computing does not require a great deal of mathematical skill.

Yes I would like to get to know the OS first. The terminal really scares me, when I type things in it either does not do anything or comes up with a lot of technical stuff that I do not understand, then again I suppose Linux embodies what computing is supposed to be like, but most of us are just used to Microsoft's do everything for you but poorly approach and rip you off in the process.

I do not see a question here, please put your questions in your own threads.

http://img181.imageshack.us/img181/8060/necromancingsv7.jpg

WW
April 2nd, 2008, 07:40 PM
I do not see a question here, please put your questions in your own threads.

syntheticz is the original poster; this is his/her thread. :)

LaRoza
April 2nd, 2008, 07:42 PM
syntheticz is the original poster; this is his/her thread. :)

Wow, a year delay.

Hows your progress OP? I dearly hope you have gotten somehwere in this time.

pmasiar
April 2nd, 2008, 08:07 PM
Wow, a year delay.

More like 4 months - since December 2007.

But true, OP's last post suggested only fear of terminals :-)

Don't worry, just take notes of what you do into your Linux book, and you will learn commands you use most often eventually. I use Midnight Commander for everything so I hardly use terminal at all (only to start mc :-) ).

What do you study in college? I hope not CompSci? :twisted:

CptPicard
April 2nd, 2008, 09:20 PM
My maths is not very good but from what people tell me, computing does not require a great deal of mathematical skill.


It really depends. At the end of my own studies for CS MSc, computing was nothing but math. Then again it depends on what you do in your computing... physical simulations can be very calculus-intensive, but as I did mostly just classical algorithmics stuff, it was mostly logic, set theory, series, logarithms... the basic compsci math toolkit is not very difficult.

However, computing does take a certain mathematical/logical mindset. But fear not, I have discovered that for me, computing was the way to develop my maths. I wasn't a math god in school either, but it just got better and better at university... and one day I just found out that I "fear" math the way I once used to.

LaRoza
April 2nd, 2008, 09:25 PM
However, computing does take a certain mathematical/logical mindset. But fear not, I have discovered that for me, computing was the way to develop my maths. I wasn't a math god in school either, but it just got better and better at university... and one day I just found out that I "fear" math the way I once used to.




More like 4 months - since December 2007.

Don't worry, just take notes of what you do into your Linux book, and you will learn commands you use most often eventually. I use Midnight Commander for everything so I hardly use terminal at all (only to start mc :-) ).


2008 - 2007 = 1

As stated above, you don't need to be a math god. Don't confuse me.

pedrotuga
April 3rd, 2008, 12:10 AM
Well... it looks like i also forget to answer so i'll take a lift on this thread digging stream.

It is not obvious from your comment: What kind of experience you have?

I know both PHP (enough not to use it) and Python, and commandline Python is **much** simpler for beginner.


I am strictly fluent in PHP, I've worked professionally with it for 3 years, i've contributed with some code to some open source projects and now i am setting up my own business, selling comercial php aplications/software pieces.
As for python, i can't say i have a knowledge of it as deep as i have of php, but i am quite fluent in it, I can do pretty much everything i might eventually want to do in python, I've coded a few complete GUI small applications in python, for private use, but everything very minimal.

I haven't figured out why php is so criticised and python is evangelized as a messiahs.
Despite python syntax being cleaner, more elegant and in some way more modern, I find php code much easier to read.

Sure some php code out there is quite messy, but if you look at good clean php, it's like crystal water, seriously.

PHP has a syntax that makes it easy to read. Variables have a visual identifyer, the type conversion works as transparent as it can be, arrays have never been so flexible and comfortable to use as they are in php, string manipulation is a piece of cake, and since PHP 5, etc etc.

Now, just for me to understand why all the poke on php, could ou tell me why you say you know enough php no to use it?
What makes it so unusable when compared to python?


Another curious fact:
Perl cryptic nature (code tend to be unreadable) is often explained with expressions like: "power and complexity", "there's more than one way to do on thing", "compact intelegent code", etc.
On the other hand PHP gets to be put down because of offering the freedom to code in non-standard (bad) ways.

I am perfectly ok saying this as I also use perl on a regular basis and find it quite useful in some tasks.

pmasiar
April 3rd, 2008, 12:36 AM
I haven't figured out why php is so criticised

Maybe instead of hijacking this thread, you may want to start "Why I love/hate PHP" tread like we have for other languages?

LaRoza
April 3rd, 2008, 12:42 AM
I haven't figured out why php is so criticised and python is evangelized as a messiahs.
Despite python syntax being cleaner, more elegant and in some way more modern, I find php code much easier to read.

PHP has a syntax that makes it easy to read. Variables have a visual identifyer, the type conversion works as transparent as it can be, arrays have never been so flexible and comfortable to use as they are in php, string manipulation is a piece of cake, and since PHP 5, etc etc.

Now, just for me to understand why all the poke on php, could ou tell me why you say you know enough php no to use it?
What makes it so unusable when compared to python?


As a PHP supporter, I do find the language itself inferior to Python in many ways.

PHP is a fine language, and I do not think it is "bad", but it leaves a lot to be desired.

PHP issues:


Lack of namespaces
Cluttered and inconsistant standard library
Encouragement of bad coding (not a flaw of the language, but it is a fact, PHP make it very easy to mix code and content)


PHP's flaws are based on its designed, it was never designed to be so big, and features were added as it goes and functions were added and old one kept. It is usable, and feature rich, but cluttered.

Compared to Python, PHP is inferior, assuming you know both equally, and have the resources to use either.

Naturally, it is very common and easy to learn and use, so it is going to last a long time.

syntheticz
April 3rd, 2008, 10:04 AM
What is PHP for? Is it the same as PHP Nuke? The only form of programming I understand at all is basic HTML. lol

GodsDead
April 3rd, 2008, 11:05 AM
PHP is a dynamic web based programmign language, used to create such open source applications as PHP Nuke, which i personally hate lol =]

Im a php programmer, i have never dabbled with python, there is also a war with ruby on rails/ hmm

pedrotuga
April 5th, 2008, 02:05 PM
LaRoza, by saying PHP is cluttered i believe your are mixing up the language itself with the function API which are two totally different things.
The language it's everything but cluttered, is in fact very simple and tidy.

Now if you're talking about the function API that ships with php, i find arguments like function name inconsistence and having all those functions in the same namespace invalid.
The only reason why all other languages don't get the same criticism is because they don't come with as much funcionalities as php comes out of the box. You have to use 3rd party modules/libraries/extensions/whatever. Often they are poorly written, but then that's not the language problem anymore.

PHP was a new concept, put in the language whatever would be necessary for its main purpose. Theoretically that's a design flaw, but lets admit it, it makes sense if we think about nowadays' programming demands.


As for lack of namespaces support, that's a valid argument, but is that really a big minus? Looks more like a small detail to me... how often do you have to deal with names collisions? Personally i don't even remember that's a problem.

The biggest minus in php in my opinion is lack of threading support. Ironically all the criticism fails to address that for some reason i never found out.

pmasiar
April 5th, 2008, 02:24 PM
LaRoza, by saying PHP is cluttered i believe your are mixing up the language itself with the function API which are two totally different things.
The language it's everything but cluttered, is in fact very simple and tidy....

Syntax of most languages is trivial (after you learned 2 or 3), library is what takes most time to learn. So having cluttered library is big minus.


As for lack of namespaces support, ... Personally i don't even remember that's a problem.

Seems like blub programmer to me. :-)

pedrotuga
April 5th, 2008, 06:31 PM
Syntax of most languages is trivial (after you learned 2 or 3), library is what takes most time to learn. So having cluttered library is big minus.

Seems like blub programmer to me. :-)

I don't know what you mean by 'blub programmer' nor I want to get into a discussion on who's the most experienced programmer in here, as i find that pointless. All I can tell you is that I am PHP programmer for a living. Ocasionaly i do some python, java and perl too and I am quite fluent in them too.

Now about the first paragraph...
If that's your big minus, i must tell you that python is even worst. In python you have to rely on dozens of third party projects, each one written in its own style, many times incomplete and sometimes poorly documented.
Even the documentation of some python modules maintained in the main python distribution is incomplete.

Now, i have nothing against python, in fact i do like it and use it even in some of my personal projects. I just don't get the point of poking on PHP for reasons that absolutely don't make any sense. I guess some programmers are jealous of the magnitude a lot of php projects got.

BTW, have a look on php.net and python.org and you'll notice one big difference besides the colossal documentation amount difference:
php.net is not stuffed with self-bragging. It goes straight to the point.

pmasiar
April 5th, 2008, 07:43 PM
I don't know what you mean by 'blub programmer' nor I want to get into a discussion on who's the most experienced programmer

Google knows everything: http://www.paulgraham.com/avg.html defines Blub

And it is not about being most experienced, but about knowing that you have blind spots - there are features in language you don't know that don't exist in languages you do know. Not being Blub programmer is to be aware of features missing in language you code for living.

Like what is MVC pattern, so missing in PHP.


If that's your big minus, i must tell you that python is even worst. In python you have to rely on dozens of third party projects,

Plenty of modules are in core, and if something is not, it is easy to find and install. Better than having to develop it, no?


Even the documentation of some python modules maintained in the main python distribution is incomplete.

This is rather strong claim, any examples? Or is it just a FUD?

ruy_lopez
April 5th, 2008, 08:42 PM
Google knows everything: http://www.paulgraham.com/avg.html defines Blub


I wouldn't attach much credence to disingenuous terms like "blub". They tend to be used exclusively by people trying too hard to appear like they are "in the know".

In my limited experience, the smartest people aren't afraid to display the limits of their understanding, rather than pretend they understand everything.

I doubt your code will suffer because you don't know the meaning of an insult. Code stands or falls on its own terms. If there are faults, it's better to be specific about the actual flaw than parrot something you heard someone else say.

CptPicard
April 5th, 2008, 08:57 PM
In my limited experience, the smartest people aren't afraid to display the limits of their understanding, rather than pretend they understand everything.

... which is pretty much the definition of not being a blub programmer.


If there are faults, it's better to be specific about the actual flaw than parrot something you heard someone else say.

It is also better to be specific about the counter-argument than merely attacking the fact that someone is using some word to describe a concept. Attack the content of the word, not the messenger (the word) :)

pmasiar
April 5th, 2008, 10:30 PM
it's better to be specific about the actual flaw than parrot something you heard someone else say.

... and it would be better if you read the link you quoted and responded to, because you would understand that it was exactly the point Paul Graham made about blub programmers :-)

LaRoza
April 5th, 2008, 10:49 PM
The only reason why all other languages don't get the same criticism is because they don't come with as much funcionalities as php comes out of the box. You have to use 3rd party modules/libraries/extensions/whatever. Often they are poorly written, but then that's not the language problem anymore.



Standard Python has more out of the box than PHP...

Standard installations of Python have a lot, although they are not all jammed into the same namespace, they are there for use.

ruy_lopez
April 5th, 2008, 11:13 PM
... and it would be better if you read the link you quoted and responded to, because you would understand that it was exactly the point Paul Graham made about blub programmers :-)

I wasn't referring to Paul Graham's comments. I was referring to the pejorative use of the term employed liberally in this forum as a means of disparaging another's programming experience. In particular, I was referring to your use of the term.

pedrotuga
April 6th, 2008, 02:31 AM
Standard Python has more out of the box than PHP...

Standard installations of Python have a lot, although they are not all jammed into the same namespace, they are there for use.

Not really
http://en.pastebin.ca/973313



Google knows everything: http://www.paulgraham.com/avg.html defines Blub

And it is not about being most experienced, but about knowing that you have blind spots - there are features in language you don't know that don't exist in languages you do know. Not being Blub programmer is to be aware of features missing in language you code for living.

Like what is MVC pattern, so missing in PHP.


pmaisar, I intend no personal content in this discussion as I already pointed. I would also recommend you to make strictly technical posts. Not only because of this forum guidelines but also because you would avoid getting into embarrassing ( IMHO ) situations like the one you just got into.

MVC is a software pattern, not a feature supported by a language. Therefore it would have no place in this discussion as an argument. Even if it would, PHP is the language that offers a larger choice of MVC frameworks.
Justt for the reccord...
qcodo, codeignitor, zendFW, cakephp, synfony, phpontrax, modx,... just to name a few, last time I checked they were more than 40.
I use either codeignitor or my own lightweight framework in almost all the software i write. I would say that PHP is the language that succeeded the best to implement that pattern, even better than ruby.
You don't need a framework to follow the MVC pattern. Or, if you prefer a different phrasing: you don't need to call 'framework' to whatever way you put your models, controllers and viewers talking with each-others.
Rasmus Lerdorf has written a very interesting article on that that gives a tip about PHP power and simplicity:
http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html




Plenty of modules are in core, and if something is not, it is easy to find and install. Better than having to develop it, no?
This is rather strong claim, any examples? Or is it just a FUD?
Yes, fortunately many modules come with a default python installation. The same applies to PHP.
As for examples of poor documentation... yes, there are several:

http://docs.python.org/lib/module-threading.html
http://docs.python.org/lib/module-xml.dom.html
...

In these cases all documentation you have is a textual description of each class member or object. Not a single proper code example nor a technical reference.

LaRoza
April 6th, 2008, 02:36 AM
Not really
http://en.pastebin.ca/973313

Yes, fortunately many modules come with a default python installation. The same applies to PHP.


Those modules are part of the language. Although they are "separate" they are part of Python.

PHP has no such thing. If one wants to use mysql function in PHP, they are immediately there. Convenient, but not when you have two sets of mysql functions and thousands of others just as available.

pmasiar
April 6th, 2008, 02:58 AM
Good language and good framework makes good practices easier to use than not.

PHP was designed to develop HTML pages, and MVC is commonly considered as the only sane way to do it. Despite that, MVC, fundamental principe of web page development, is external to PHP. Yes, you mentioned 40 frameworks: it means there is 40 different ways to do it, and most beginners will use neither, because it is hard to choose, and hard to use (not using MVC is simpler in PHP). This I consider fundamental design flaw of PHP. 40 MVC frameworks is not a feature, it is a bug.

Python was not designed for web development, but after couple less-than-successful efforts (and nudge from RoR, and Google hiring Guido to develop web app :-) ) two leading frameworks emerged (focused on two different approaches). Programming in MVC pattern using Python and Turbogears/Pylons or Django is simpler than non using MVC, and even beginners do the right thing.

pedrotuga
April 6th, 2008, 12:25 PM
LaRoza, personaly i blieve that, for begginners, it's actually easier to have all the functions acessible in the main namespace. Otherwise you have to explain them what a namespace is and how to use namespaces.
Honestly, if that's all that the "php is evil" mambo jambo is about, i don't think it's a big deal at all. Other languages have fairly bigger problems.

pmaiser, I don't know anymore what point you are trying to stand for in here.
Patterns are not language bugs, limitations, features, or whatsoever.

PHP does much more than web applications. That's another common mis assumption.

Sorry, but it's not the purpose of a language to come with support for a pattern, in fact there's no such thing.

The only thing i said is that MVC web framework implementations were more successful in PHP than in any other language.

What you fail to explain is how and why a couple of python frameworks are a good thing and very easy to use by begginners and all the PHP frameworks are just a signal of how PHP fails to enforce an MVC approach.

I should say that the i consider the above statement not valid, but that's just my opinion. Nevertheless, I would like to know what did you base those conclusions on to understand our point of view.

LaRoza
April 6th, 2008, 12:43 PM
LaRoza, personaly i blieve that, for begginners, it's actually easier to have all the functions acessible in the main namespace. Otherwise you have to explain them what a namespace is and how to use namespaces.
Honestly, if that's all that the "php is evil" mambo jambo is about, i don't think it's a big deal at all. Other languages have fairly bigger problems.


I think it is better to have a small core for the langauge, that is easily enhanced.

A language with a lot of built in functions and features is confusing I think.

CptPicard
April 6th, 2008, 04:04 PM
LaRoza, personaly i blieve that, for begginners, it's actually easier to have all the functions acessible in the main namespace. Otherwise you have to explain them what a namespace is and how to use namespaces.

I'd rather not have anyone working as a programmer -- at least not as my colleague -- writing production-quality stuff who gets tripped up by the concept of namespaces and needs to be hand-held over that by stuffing everything into the same namespace and thus crippling the language :)

It's a kind of false economy...

pedrotuga
April 6th, 2008, 04:58 PM
I'd rather not have anyone working as a programmer -- at least not as my colleague -- writing production-quality stuff who gets tripped up by the concept of namespaces and needs to be hand-held over that by stuffing everything into the same namespace and thus crippling the language :)

It's a kind of false economy...

Either my comprehension of English is poor, or you are talking about something else rather than what we are discussing in here.

with all due respect, what are you talking about?
This topic is about a programming options for beginners. Obviously a beginner does not work professionally writing production-quality software. No mater how much of a genius or dummy he/she might eventually be.
Besides that, no mater how intelligent you are, in order to know what a namespace (or any other thing) is, you need to acquire that information from somewhere. And i didn't said that a beginner would get confused, i just said he would have to learn that concept first.

Honestly, throwing pejorative comments of a class of programmers just because they use a language that you don't like or don't know is just ridiculous and in fact it tells more about the ones that do that kind of comments.

CptPicard
April 6th, 2008, 06:20 PM
This topic is about a programming options for beginners. Obviously a beginner does not work professionally writing production-quality software. No mater how much of a genius or dummy he/she might eventually be.

So PHP should aim to be a toy language with perpetual training wheels on so that n00bs don't have to understand namespaces, even though it means that when some of them do become professionals, they will suffer due to that design decision?



Besides that, no mater how intelligent you are, in order to know what a namespace (or any other thing) is, you need to acquire that information from somewhere.

Such is the nature of learning. Nothing to be afraid of in there.

pmasiar
April 6th, 2008, 07:47 PM
pmaiser, I don't know anymore what point you are trying to stand for in here.
Patterns are not language bugs, limitations, features, or whatsoever.

Sorry, but it's not the purpose of a language to come with support for a pattern, in fact there's no such thing..

It is pmasiar :-)

Of course missing pattern is not a language bug. But not implementing pattern used for main area of usage can be considered a flaw. If it is major area of use, it is major flaw.

There are many languages which implement OO, because OO is considered important pattern. Stack is pattern, first CPU did not implemented stack in hardware, now it is common. Subroutine is pattern, IBM/360 could not CALL and RETURN, it has to be handled in code (using BR14, ahh good old times :-) ). C does not have OO implemented in language, but you can build it in. There are multiple OO "frameworks" for C.


The only thing i said is that MVC web framework implementations were more successful in PHP than in any other language.

What you fail to explain is how and why a couple of python frameworks are a good thing and very easy to use by begginners

The fact that PHP has many MVC framework makes obvious that it is needed, right? 3 years ago Python was in such situation, joke was that Python is the only language which has more web app frameworks then reserved keywords. Community got together, and from all of the two crystallized, fiercely competing for first place. And Django is the one for Python beginners.

It is well known that if person has to choose from too many choices, many people refuse to choose and use none.


[how] all the PHP frameworks are just a signal of how PHP fails to enforce an MVC approach.

I am not sure: Do you claim that PHP does enforce MVC? Ie TurboGears (and for sure Django also), when you start new project, admin script will generate proper project structure with subdirectories, model, view and controller modules separately, templates, static files etc, so you have running valid "hello world" app in MVC. From that point it is hard not to follow MVC.

pmasiar
April 6th, 2008, 08:19 PM
Namespace, at least in Python, is trivial to understand. Statement "import module1" creates namespace module1. Then, you can access any name in that namespace using namespace prefix, like module1.name1, and it will be different from module2.name1. Any magic behind it is completely transparent for beginners, extremely useful for developers, and not implementing it in PHP in some way shows something about PHP language designers - your choice what :-)

pedrotuga
April 7th, 2008, 07:01 PM
@pmasiar
Well, I believe you find it easy to understand, I do also, but i should tell you that you just failed to define it.

I mean no offense with this, but it looks to me that you got the concept of software pattern wrong.

OO is not a software pattern, it is programming paradigm. And no language implemented OO, you don't implement a paradigm, that doesn't make sense, at all.
Many languages implemented classes which is makes OO approaches easy, but that's all.

A CALL RETURN method would be a pattern if you actually program a programming language with functions support.Otherwise is just a language feature.
The stack is a data structure which falls into a more specific classification than "pattern".

I've tried to understand what you mean with all the frameworks talk. I didn't understand. Tubo gears, django, ror,cakephp, and every MVC framework work the way you described. That's what the MVC pattern is all about.

PHP, like python and every other language does not enforce MVC nor any other pattern. So, the answer is no.

@cptpicard

no, php is not supposed to be an eternal toy language. Lack of namespaces support is a real disadvantage of PHP. I just think its ridiculous to poke on PHP and claim is bad and then having as the one one and only argument the fact of not having namespaces support.

pmasiar
April 7th, 2008, 08:56 PM
I believe you find [namespace] easy to understand, I do also, but i should tell you that you just failed to define it.

I did not tried to define it - I just tried to show how intuitive it is, so not having it (and claiming it is too complicated for beginners) - I just don't buy it.


OO is not a software pattern, it is programming paradigm. And no language implemented OO, you don't implement a paradigm, that doesn't make sense, at all.

so OO programs need different hardware? Yes of course OO syntax sugar is implemented in every language, it is just done covertly, in C you have to do it overtly (as pattern, because compiler does not have the syntax sugar). It is all translated to ASM instructions, remember?


Many languages implemented classes which is makes OO approaches easy, but that's all.

Classes == OOP. If you have classes, you have OOP, it is same thing.

http://blog.plover.com/2006/09/11/ - how to implement OOP pattern on C (and from where all my "understanding" come - I am not smart enough to figure it myself, it was revelation to me :-) )


A CALL RETURN method would be a pattern if you actually program a programming language with functions support.Otherwise is just a language feature.

As I said, I programmed in hardware (IBM/360) which missed that feature (CALL/RETURN CPU instruction as I guess all CPUs have now). So it was implemented by conventions in ASM code. Not as instruction, but as pattern - convention.


every MVC framework work the way you described.

Lucky you if all frameworks you used are that easy.
Many MVC frameworks I worked with are not as easy. Struts, CGI::Application - no such luck. Pain to get started, easy to set up wrong. I don't know about PHP frameworks, I don't like PHP. :-)

slavik
April 8th, 2008, 03:13 AM
you don't need 'classes' for OO, the C++ compiler will be plenty happy if you throw structs at it with functions inside ;)

LaRoza
April 8th, 2008, 04:24 AM
you don't need 'classes' for OO, the C++ compiler will be plenty happy if you throw structs at it with functions inside ;)

ECMAScript is OO, but has no classes. It is prototype based.

slavik
April 8th, 2008, 06:58 AM
ECMAScript is OO, but has no classes. It is prototype based.
that's my point :)

pedrotuga
April 9th, 2008, 06:05 PM
As already two people pointed, classes are not a synonym of object oriented programming. In fact, if you use classes for syntax purposes you are just introducing unnecessary complexity in your code.
If you don't take advantage of concepts like class inheritance and polymorphism then you are not programming as the OO paradigm tells you to. This is valid iven if you are using a so-called Object Oriented Language.

A lot of these theorical concepts have disputed meaning and sometimes become so relative to the point they are useless. Despite that, i think you are mixing up stuff like paradigms, patterns, and implementations.

If you read carefully the blog post you linked, it has a quote inside it which is a definition of pattern. Ironically, the blog author didn't realize that the quote he made clearly doesn't cover his code hack exposed in that very same blog post as a pattern.

Classes == OOP <= you need to realize that this is absolutely not true because of the reason I explained in the first paragraph. I believe that's where all the confusion of this topic is.

I've also made machine code back in university but to be honest I am not so familiar with processor families naming nor their characteristics. Therefore i don't know so much about actual computer architectures. I believe they're still working the same way... just faster, with more registry room and some of them with a wider input. But that's all i know.
Sorry, I don't have the knowledge to discuss processors' features.

CptPicard
April 9th, 2008, 08:33 PM
As already two people pointed, classes are not a synonym of object oriented programming.

Maybe, but considering how central they still are to encapsulation (both namespace and private/public sense) and creating your own type hierarchies... I would be hard pressed to making similar claims SA was making in that other thread a few days ago that, for example, C is a superior OO language because you have to use structs and function pointers ;)



In fact, if you use classes for syntax purposes you are just introducing unnecessary complexity in your code.

Namespace grouping... think of them as modules in that sense.


If you don't take advantage of concepts like class inheritance and polymorphism then you are not programming as the OO paradigm tells you to.

The OO paradigm has got a lot less dogmatic about all that design pattern stuff in recent times, mostly because many of the design patterns are essentially indirection hacks around strict typing :)

But, creating your own types and their inheritance hierarchies and making use of polymorphism is such a central feature of most OOP languages that one can't just ignore it. Classes are a central concept in all that.



A lot of these theorical concepts have disputed meaning and sometimes become so relative to the point they are useless.

But, in order to have a meaningful discussion, one needs to at least try to agree on concepts, instead of escaping into hand-waving semantic muddling of concepts, hoping it makes the issue at hand irrelevant in the process. :) In a bona fide conversation, OOP and the classes' place in them is generally rather common-sensically understood (again, check out the thread where SA and I were sparring over HLL vs. low-level language)

pedrotuga
April 10th, 2008, 06:47 PM
I don't know if that last paragraph was meant to say anything to me. But that's exactly what i've been trying to avoid to say in this topic.
Read the thread again and check out how many concepts did pmaisar thrown into tis discution. The only reason why I used them in my replies is because they were misused and wrong, in my opinion.

I don't think one need to try to at least agree on concepts, I would say all the parts should at least try to UNDERSTAND the concepts. Like, i don't picture myself agreeing on something based on a wrong assumption just for the concept agreement's sake.
What i would do is trying to understand other person's point of view even if it's the oposite of mine, but it would have to be based on arguments that both parts acept as valid and idealy would be correct.

Classes = OOP
is a tottaly wrong afirmation. Sure classes have central importance, in most of the cases the OOP paradigm is achieved exclusively by their usage. So what? How does that makes the initial statement right?

I don't know what you consider OOP to be, but if you don't think class inheritance and and polymorphism are the whole point of it, let me know how do you take advantage of it.
Namespace grouping? Is that all?
For me that's just an extra tiddyness that comes as a result of the usage of classes.
In my opinion that's not even worth syntax complexity increment.

PHP for example has variable function names, you can use it to that purpose if ou want. Creatting a class strictly for namming and grupping is plain bloat. But that's just my opinion.

CptPicard
April 10th, 2008, 08:06 PM
I don't think one need to try to at least agree on concepts, I would say all the parts should at least try to UNDERSTAND the concepts.

Fair enough.

My issue is that I see all too often, when an argument begins to falter, a withdrawal to either muddling concepts to water down the logical situation, or alternatively a willful ignorance of the bona fide meaning of the concepts the other side is using -- depending on which one is useful. Just a technical point.



but it would have to be based on arguments that both parts acept as valid and idealy would be correct.

Yeah, and the aforementioned seeks to dismantle that objective basis.



I don't know what you consider OOP to be, but if you don't think class inheritance and and polymorphism are the whole point of it, let me know how do you take advantage of it.

I said exactly the opposite to this -- my statement was that inheritance and polymorphism are pretty much the features of OOP... it's all about your own type hierarchies and ability to substitute any subclass for superclass because of external contract of encapsulated behaviour.



Namespace grouping? Is that all?


No, it's certainly not all. See above. :) But it is a good specific response for your specific issue. Do not extend it beyond that.

You could, by the same token, argue against all modules, if we keep to the issue you raised... it's not "clutter".

But of course, classes do so much more. As you know, they package the code with the data the code uses, so the modularity goes a step further.

pmasiar
April 10th, 2008, 08:51 PM
OK guys I do not clain I am OOP guru. Apologies if I misunderstood something or said any OOP heresy, it was not intentional. I wanted to help someone who was (IMHO) even more confused than myself. Sorry if it was not the case. There are plenty of "programmers" who know only PHP and nothing else and don't hesitate to express bold claims, if you are not one of them, I am glad for you.

I want to spend my time on learning GAE and not defending OOP or MVC in PHP, Python, Blub or elsewhere. Feel free to continue discussion without me. Have a nice day!

pedrotuga
April 10th, 2008, 10:05 PM
Not really an heresy, more like a common mistake that is pretty much the reason why so many not so experienced people, like this topic author, get all confused with OOP.

This got quite faraway from the initial topic. In all this side discussion I tried to explain why PHP is an option and it's a quite proper and capable language in opposition to what other language fanatics claim.
I think this phenomena happens because PHP is as far as i know the first case of a language that didn't claim to be the superior language that will kick everybody's ***, but it became hugely popular anyway.
I guess that make programmers of superior languages envious.

Just as a footnote, I hear far more often ignorant rants on PHP than i hear fanatic complements to it.