FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How do we manage large code sets in PHP?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How do we manage large code sets in PHP? [message #169657] Tue, 21 September 2010 23:07 Go to next message
Michael is currently offline  Michael
Messages: 9
Registered: September 2010
Karma: 0
Junior Member
In C/C++ we create manageable files and compile/link them together
into a single executable. What do we do in PHP?
Re: How do we manage large code sets in PHP? [message #169658 is a reply to message #169657] Tue, 21 September 2010 23:20 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Michael wrote:
> In C/C++ we create manageable files and compile/link them together
> into a single executable. What do we do in PHP?

Shit loads of includes.
Or don't write major projects in it.

If you want to create a monster, create it as a php library, written in
C or C++ (if you must)

PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
great little tool: A professional large project programming language? No.
Re: How do we manage large code sets in PHP? [message #169660 is a reply to message #169657] Tue, 21 September 2010 23:29 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 9/21/2010 7:07 PM, Michael wrote:
> In C/C++ we create manageable files and compile/link them together
> into a single executable. What do we do in PHP?

First of all PHP is not compiled - it is interpreted. So you don't
compile or link them.

But basically, you do it the same as in C/C++ - modularize your code,
use functions and classes as appropriate. But where the C/C++
compile/link step effectively includes everything together into one
file, you do it yourself with include statements in your main module
(and others, as necessary).

Not really that hard once you get used to it. And despite what TNP
claims, PHP is used for a lot of things other than web pages. But then
he thinks a return statement is the same as a goto, so what do you expect?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: How do we manage large code sets in PHP? [message #169661 is a reply to message #169658] Wed, 22 September 2010 00:15 Go to previous messageGo to next message
Michael is currently offline  Michael
Messages: 9
Registered: September 2010
Karma: 0
Junior Member
On Sep 21, 4:20 pm, The Natural Philosopher <t...@invalid.invalid>
wrote:
> Michael wrote:
>> In C/C++ we create manageable files and compile/link them together
>> into a single executable. What do we do in PHP?
>
> Shit loads of includes.
> Or don't write major projects in it.
>
> If you want to create a monster, create it as a php library, written in
> C or C++ (if you must)
>
> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
> great little tool: A professional large project programming language? No.

Thanks for your response. But if that's the case, (can't be used for
large programming projects), what do we use instead?
Re: How do we manage large code sets in PHP? [message #169662 is a reply to message #169661] Wed, 22 September 2010 00:27 Go to previous messageGo to next message
Michael is currently offline  Michael
Messages: 9
Registered: September 2010
Karma: 0
Junior Member
On Sep 21, 5:15 pm, Michael <MichaelDMcDonn...@yahoo.com> wrote:
> On Sep 21, 4:20 pm, The Natural Philosopher <t...@invalid.invalid>
> wrote:
>
>> Michael wrote:
>>> In C/C++ we create manageable files and compile/link them together
>>> into a single executable. What do we do in PHP?
>
>> Shit loads of includes.
>> Or don't write major projects in it.
>
>> If you want to create a monster, create it as a php library, written in
>> C or C++ (if you must)
>
>> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
>> great little tool: A professional large project programming language? No.
>
> Thanks for your response. But if that's the case, (can't be used for
> large programming projects), what do we use instead?

Another follow-up comment... what I'd really like to do is handle the
server side in C/C++. Is this possible?
Re: How do we manage large code sets in PHP? [message #169663 is a reply to message #169661] Wed, 22 September 2010 03:44 Go to previous messageGo to next message
Hamish Campbell is currently offline  Hamish Campbell
Messages: 15
Registered: September 2010
Karma: 0
Junior Member
On Sep 22, 12:15 pm, Michael <MichaelDMcDonn...@yahoo.com> wrote:
> On Sep 21, 4:20 pm, The Natural Philosopher <t...@invalid.invalid>
>> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
>> great little tool: A professional large project programming language? No.
>
> Thanks for your response. But if that's the case, (can't be used for
> large programming projects), what do we use instead?

TNP's comments were misleading - the size of the codebase has nothing
to do with whether you would need a compiled option. SPL autoloading
<http://php.net/manual/en/function.spl-autoload.php> will let you load
class libraries dynamically as required. You start to use compiled PHP
modules because you need significant performance gains (e.g. very high
traffic websites) or you are doing something unusually computationally
expensive. Until that point, it is generally a huge time (=money)
saver to write interpreted (rather than compiled) code.

PHP is a perfectly good language for building websites of any size,
and the perception that it's somehow inferior to the task than "real"
programming languages is a throwback to simpler times. Of course, if
you'd like to write everything from scratch in C or C++, no one is
going to stop you, but you're in the wrong place to get help there.

* footnote: You might also be interested in HPHP - Facebook's Open
Source PHP compiler (see <http://github.com/facebook/hiphop-php>). It
allows you to continue writing PHP but compile it into a server
instance. It's a pain to set up but it actually works really well,
especially if you're deploying to multiple machines.
Re: How do we manage large code sets in PHP? [message #169664 is a reply to message #169657] Wed, 22 September 2010 07:36 Go to previous messageGo to next message
Willem Bogaerts is currently offline  Willem Bogaerts
Messages: 8
Registered: September 2010
Karma: 0
Junior Member
On 22/09/10 01:07, Michael wrote:
> In C/C++ we create manageable files and compile/link them together
> into a single executable. What do we do in PHP?

Create manageable files also.

There is no difference in that respect with C++, java or most other
languages. You can put your files in an organised directory structure if
that helps, just like in the language you were used to.

The main differences are:
- Your source is the executable. No need to compile anything. But if
your source is a huge secret you might have a problem with it. And every
library file can be executed.
- (for web projects) your directory structure is much more dictated by
security considerations. You probably want to keep the library files
outside of the web root, and only put files inside the web root that
must be called by a browser. If you want both secure and non-secure
sections of your site, you probably want two web roots as well.

Source code control systems are a nice tool for organizing code, also in
PHP. For example, see
http://www.howtoforge.org/set-up-a-modular-svn-repository-for-php-websites

Good luck,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Re: How do we manage large code sets in PHP? [message #169665 is a reply to message #169657] Wed, 22 September 2010 07:42 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 22/09/2010 1:07, Michael escribió/wrote:
> In C/C++ we create manageable files and compile/link them together
> into a single executable. What do we do in PHP?

Sorry, but this is a really weird question. If you don't even know that
PHP is not a compiled language, I'm not sure about what you expect to
learn about large code sets handling.

Whatever, in C/C++ you almost never have a single executable. You have
an executable plus a good bunch of linked libraries (*.dll in Windows,
*.so in Linux). In PHP you only have the source code files you write:
the interpreter runs the one you instruct it to and some other files may
get run as well if you linked them from the main file.

Whatever, you should first learn some basics about PHP and, if that's
the case, about how the web works (it's entirely different from desktop
apps).



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: How do we manage large code sets in PHP? [message #169666 is a reply to message #169662] Wed, 22 September 2010 07:43 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 22/09/2010 2:27, Michael escribió/wrote:
> On Sep 21, 5:15 pm, Michael<MichaelDMcDonn...@yahoo.com> wrote:
>> On Sep 21, 4:20 pm, The Natural Philosopher<t...@invalid.invalid>
>> wrote:
>>
>>> Michael wrote:
>>>> In C/C++ we create manageable files and compile/link them together
>>>> into a single executable. What do we do in PHP?
>>
>>> Shit loads of includes.
>>> Or don't write major projects in it.
>>
>>> If you want to create a monster, create it as a php library, written in
>>> C or C++ (if you must)
>>
>>> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
>>> great little tool: A professional large project programming language? No.
>>
>> Thanks for your response. But if that's the case, (can't be used for
>> large programming projects), what do we use instead?
>
> Another follow-up comment... what I'd really like to do is handle the
> server side in C/C++. Is this possible?

Of course it is. Read about CGI.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: How do we manage large code sets in PHP? [message #169667 is a reply to message #169657] Wed, 22 September 2010 07:52 Go to previous messageGo to next message
Gordon[1] is currently offline  Gordon[1]
Messages: 6
Registered: September 2010
Karma: 0
Junior Member
On Sep 22, 12:07 am, Michael <MichaelDMcDonn...@yahoo.com> wrote:
> In C/C++ we create manageable files and compile/link them together
> into a single executable. What do we do in PHP?

http://www.php.net/manual/en/function.spl-autoload-register.php
Re: How do we manage large code sets in PHP? [message #169668 is a reply to message #169661] Wed, 22 September 2010 07:56 Go to previous messageGo to next message
Gordon[1] is currently offline  Gordon[1]
Messages: 6
Registered: September 2010
Karma: 0
Junior Member
On Sep 22, 1:15 am, Michael <MichaelDMcDonn...@yahoo.com> wrote:
> On Sep 21, 4:20 pm, The Natural Philosopher <t...@invalid.invalid>
> wrote:
>
>> Michael wrote:
>>> In C/C++ we create manageable files and compile/link them together
>>> into a single executable. What do we do in PHP?
>
>> Shit loads of includes.
>> Or don't write major projects in it.
>
>> If you want to create a monster, create it as a php library, written in
>> C or C++ (if you must)
>
>> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
>> great little tool: A professional large project programming language? No.
>
> Thanks for your response. But if that's the case, (can't be used for
> large programming projects), what do we use instead?

It can, Facebook and Wikipedia are written in PHP for example. Be
careful who you listen to when taking advice, and be sure to verify
what people are saying to you in here. Don't take everything at face
value.
Re: How do we manage large code sets in PHP? [message #169669 is a reply to message #169661] Wed, 22 September 2010 08:42 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article
<f16fa7d6-47a6-491c-80e6-ff0e825a2708(at)x20g2000pro(dot)googlegroups(dot)com>,
Michael <MichaelDMcDonnell(at)yahoo(dot)com> wrote:

> On Sep 21, 4:20
Re: How do we manage large code sets in PHP? [message #169670 is a reply to message #169661] Wed, 22 September 2010 09:50 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Michael wrote:
> On Sep 21, 4:20 pm, The Natural Philosopher <t...@invalid.invalid>
> wrote:
>> Michael wrote:
>>> In C/C++ we create manageable files and compile/link them together
>>> into a single executable. What do we do in PHP?
>> Shit loads of includes.
>> Or don't write major projects in it.
>>
>> If you want to create a monster, create it as a php library, written in
>> C or C++ (if you must)
>>
>> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
>> great little tool: A professional large project programming language? No.
>
> Thanks for your response. But if that's the case, (can't be used for
> large programming projects), what do we use instead?

I told you. PHP superstructure and library written in something else.
Re: How do we manage large code sets in PHP? [message #169671 is a reply to message #169662] Wed, 22 September 2010 09:51 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Michael wrote:
> On Sep 21, 5:15 pm, Michael <MichaelDMcDonn...@yahoo.com> wrote:
>> On Sep 21, 4:20 pm, The Natural Philosopher <t...@invalid.invalid>
>> wrote:
>>
>>> Michael wrote:
>>>> In C/C++ we create manageable files and compile/link them together
>>>> into a single executable. What do we do in PHP?
>>> Shit loads of includes.
>>> Or don't write major projects in it.
>>> If you want to create a monster, create it as a php library, written in
>>> C or C++ (if you must)
>>> PHP is BASIC, for web designers. The OSS answer to Visual Basic. It's a
>>> great little tool: A professional large project programming language? No.
>> Thanks for your response. But if that's the case, (can't be used for
>> large programming projects), what do we use instead?
>
> Another follow-up comment... what I'd really like to do is handle the
> server side in C/C++. Is this possible?

Of course it is.

No NEED to use PHP at all.
Re: How do we manage large code sets in PHP? [message #169681 is a reply to message #169661] Wed, 22 September 2010 16:31 Go to previous message
Twayne is currently offline  Twayne
Messages: 135
Registered: September 2010
Karma: 0
Senior Member
In news:f16fa7d6-47a6-491c-80e6-ff0e825a2708(at)x20g2000pro(dot)googlegroups(dot)com,
Michael <MichaelDMcDonnell(at)yahoo(dot)com> typed:
> On Sep 21, 4:20 pm, The Natural Philosopher
> <t...@invalid.invalid> wrote:
>> Michael wrote:
>>> In C/C++ we create manageable files and compile/link them
>>> together into a single executable. What do we do in PHP?
>>
>> Shit loads of includes.
>> Or don't write major projects in it.
>>
>> If you want to create a monster, create it as a php
>> library, written in C or C++ (if you must)
>>
>> PHP is BASIC, for web designers. The OSS answer to Visual
>> Basic. It's a great little tool: A professional large
>> project programming language? No.
>
> Thanks for your response. But if that's the case, (can't be
> used for large programming projects), what do we use
> instead?

I think first you need to define what "large" means.
Secondly, PHP is really meant to be used within HTML code, the page getting
a .php extension instead of .html or .htm.
PHP operates server-side, away from prying eyes when done properly, and its
work is never intended to be seen. Its output is HTML back to the visitor.
There is no PHP code to be seen in the Source View.

If you're looking to compile PHP into an executable, it CAN be done, a la
the way HTML executables are made into executables. But it doesn't really
gain you anything. www.PHP.net or www.w3schools.com would explain the above
intent of PHP in much greater detail. It's old,, it's free, it's current and
it's powerful when used properly.

A clarification of what it is you expect PHP to do would probably get you
much more targeted responses.

HTH,

Twayne`
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: empty __FILE__ in quercus
Next Topic: Dynamic field names in recordset
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 12 21:58:55 GMT 2024

Total time taken to generate the page: 0.02624 seconds