Introducing Python [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
The company I used to work with has two developers working fulltime, and a handful of freelancers. They're in the process of hiring a new lead developer to try to bring order and management to the development.
But, currently, one of the developers has seen the light of Django (the company has only developed in PHP to date) while the other developer is concerned that introducing a new language (Python) is a bad idea right now.
How should they approach introducing this new technology? Obviously with only one of the developers actually knowing Python, there will be no redundancy when that dev is away or leaves the company.
Should they bother to introduce Python, or should they look for PHP-only solutions until such a time when the team actually have more than one Pythonion? Without a team leader, the decisions are having to fall to them.

I recently introduced Python to my company, which does consulting work for the Post Office. I did this by waiting until there was a project for which I would be the only programmer, then getting permission to do this new project in Python. I then did another small project in Python with similarly impressive results. In addition, I used Python for all of my small throwaway assignments ("can you parse the stats in these files into a CSV file organized by date and site?", etc) and had a quick turnaround time on all of them.
I also evangelized Python a bit; I went out of my way to NOT be obnoxious about it, but I'd occasionally describe why I liked it so much, talked about the personal projects I use it for in my free time and why it's awesome for me, etc.
Eventually we started another project and I convinced everyone to use Python for it. I took care to point everyone to a lot of documentation, including the specific webpages relating to what they were working on, and every time they had a question, I'd explain how to do things properly by explaining the Pythonic approach to things, etc.
This has worked really well. However, this might be somewhat different than what you're describing. In my case I started with moderately small projects and Python is only being used for new projects. Also, none of my co-workers were really Perl or PHP gurus; they all knew those languages and had been using them for awhile, but it didn't take much effort for them to become more productive in Python than they'd been before.
So if you're talking about new projects with people who currently use PHP but aren't super-experts and don't love that language, then I think switching to Python is a no-brainer. However, if you're talking about working with a large existing PHP code base with a lot of very experienced PHP programmers who are happy with their current setup, then switching languages is probably not a good idea. You're probably somewhere in between, so you'll have to weigh the tradeoffs; hopefully my answer will help you do that.

If the mandate of the new lead is to put the house in order, the current situation should likely be simplified as much as possible prior. If I had to bring things to order, I wouldn't want to have to manage an ongoing language conversion project on top of everything else, or at least I'd like some choice when initiating the project. When making your recommendation, did you think about the additional managerial complexity that coming into the middle of a conversion would entail?

#darkdog:
Using a new language in production code is about more than easy syntax and high-level capability. You want to be familiar with core APIs and feel like you can fix something through logic instead of having to comb through the documentation.
I'm not saying transitioning to Python would be a bad idea for this company, but I'm with John--keep things simple during the transition. The new lead will appreciate having a say in such decisions.
If you'd really, really, really like to introduce Python, consider writing some extensions or utilities in straight-up Python or in the framework. You won't be upsetting your core initiatives, so it will be a low/no-risk opportunity to prove the merits of a switch.

I think the language itself is not an issue here, as python is really nice high level language with good and easy to find, thorough documentation.
From what I've seen, the Django framework is also a great tooklit for web development, giving much the same developer performance boost Rails is touted to give.
The real issue is at the maintenance and management level.
How will this move fragment the maintenance between PHP and Python code. Is there a need to migrate existing code from one platform to another? What problems will adopting Python and Django solve that you have in your current development workflow and frameworks, etc.

It's really all about schedules. To me the break should be with a specific project. If you decide your direction is Django then start new projects with that. Before you start a new project with a new language/framework, either make sure that you have scheduled time to get up to speed in this new direction, or get up to speed before using on new projects.
I would avoid going with a tool of the month. Make sure you want it to be your direction and commit some time/resources to learning enough to make a good decision.

Well, python is a high level language.. its not hard to learn and if the guys already have programming knowledge it should be much easier to learn.. i like django.. i think it should be a nice try to use django ..

I don't think it's a matter of a programming language as such.
What is the proficiency level of PHP in the team you're talking about? Are they doing spaghetti code or using some structured framework like Zend? If this is the first case then I absolutely understand the guy's interest in Python and Django. It this is the latter, it's just a hype.

I love Python and Django, and use both to develop the our core webapps.
That said, it's hard to make a business case for switching at this point. Specifically:
Any new platform is risky compared to staying with the tried and true
You'll have the developer fragmentation you mentioned
It's far easier to find PHP programmers than python programmers
Moreover, as other posters have mention, if the issue is more with spaghetti code than PHP itself, there are plenty of nice PHP frameworks that could be used to refactor the code.
That said, if this developer is excited about python, stopping them outright is probably demoralizing. My suggestion would be to encourage them to develop in python, but not the mission critical parts of the app. Instead they could write some utility scripts, some small internal application that needs doing, etc.
In conclusion: I don't recommend switching from PHP, but I do recommend accommodating the developer's interest in some way at work.

Related

Benefits of creating a custom mvc framework

Would creating a custom php mvc framework from scratch be completely pointless for a small digital agency?
I have heard recently from a friend that His colleges are infact spending time on such a project within their agency. Their argument against using another such as cake or zend being that they come with so many unused features and therefore lots of unnecessary code.
I would have thought that such an endevour is completely pointless and indeed a waste of time and money. Surely it would make more sense to pick a framework that matches your needs as close as possible and then customise/extend it. On such frameworks as zend the code is surely going to be of a much better/tested level than that of 1 or 2 programmers could create in a few months.
It just doesn't make sense to me - can anyone pursuade me otherwise?
Using your own framework has one big advantage over other solutions. It means you have total i mean TOTAL! controll over it. No matter what happens to other frameworks, because one day you have open source software and another day it could be abbandoned or stopped project. And your framework will still be developed. Even if it means you will need to constantly add some features to it, with time it will pay off. Besides, PHP is like one huge framework after all, and it's evolving. Writing your own framework will keep you up to date with this technology :) Of course keeping with other frameworks or CMSes is also good idea, because maybe your clients will want to use them, and you can also learn from them and move some solutions to your software :D
No, I think you will find most here would agree with you - I certainly feel it is a complete waste of time. Especially given that they are a small agency, their limited resources could be better spent elsewhere.
Since they are concerned about a bloated framework, I suggest that instead they investigate using a lightweight PHP framework such as CodeIgniter and Kohana.
I see it pointless. But it's a curse of PHP programmers who tend to invent wheel again and again. I know what I'm talking about. I tried it too.
The best approach seems to be to learn a framework and if it doesn't suit you ask friends who knows other frameworks to learn how is the particular problem solved in other frameworks and if none of them seems good then MAYBE it's time to start work on a new framework.
The point with lots of unused code is not completely valid. Zend contains classes that can be stripped off as far as I know.
EDIT: Performance of PHP can be enhanced via eAccelerator for example. I find it easier than building a brand new framework.
MVC FW is less than 5% of average project code base, so I strongly recommend building MVC for every project and adapt it to the project specifications.
If someone has enough knowledge about MVC pattern and some experience in using and building MVC frameworks, it can be built in some days.
General arguments are speed and performance given by the custom FW.
Sometimes when people are afraid of changes and learning new things, they come up with all kinds of silly reasons why somethings is bad and should not be used.
I once worked in company that was determined to write their own web framework instead of using Django. One of the developers that was working on "admin" part of framework said i wanted him to lose his job cos Django has auto generated admin.
Unless is it very specific framework and you have very good reasons and enough fundings for project it is never a good idea to reinvent the wheel specially if you can't make it the same or better quality then what is already out there.
It depends on what kind of projects they do, and what are their needs. Never forget that in software, the 'best' always depends on what you are doing. There is no 'one golden solution' for everything. This includes mvcs.
There are various reasons to code your own mvc :
You can tailor it to your exact specific needs
You can keep it closed source, reducing exposure, increasing security due to obscurity
You can continue developing it, and then release it to the world when it is mature and fulfills a major purpose - a lot of current mvcs came to being in that way anyway.
You can continue developing it, keep it closed source code, and build massive SaaS services and applications on it, to which you will retain full rights. Can be done with apache license too though.
You can fulfill a purpose that is not fulfilled by any other mvc. Despite every mvc has its zealots who believe that they have the one and all solution, every mvc has its downsides. And believing that 'everything that can be done, has been done' because there are 15-20 mvcs out, is as stupid as saying 'all that can be discovered has been discovered'. And there were people saying the latter at the start of 20th century.
Not to mention that with an external mvc you are using, you are obliged to that mvc's project team for many things. They may already have or may introduce things that you dont like, or even hamper your specific applications.
Not to mention they may just get abandoned. Can happen to the biggest. Codeigniter was all the rage. What happened ? Ellis is dumping it basically. Development slowed down to a halt. Probably soon totally halting. Being open sourced does not guarantee a project either - there have been many open source projects which went similar ways.
What's going to happen to people who had coded major applications with Codeigniter ? Are they going to undertake the security of the Codeigniter installations they have themselves ? Therefore de facto becoming maintainers of their own mvc ? Or are they going to hire external parties to maintain the mvc for them ?
Not a good future investment.
My preference for coding my own mvc is mainly to have a mvc that fits my own style of coding. My criteria for a mvc :
Fast development
Fast modification
Low maintenance
Speed
Security
Extreme simplicity
Reliability in regard to future development
I have coded a major mvc for myself before. and i am still successfully running it on one of my hobby websites which handles ~600,000-1,200,000 unique visitors per month. At a given moment, 250+ visitors (google analytics - it doesnt include any bots) can be present on the site, hammering page after page. And it does not even blink. I like that. Despite it has various shortcomings that i dont like, it works spectacularly.
In the current mvc im doing, im using the lessons i learned from the previous one, as they apply to my specific purposes.
Not to mention it is a great way to hone and develop new skills.
But one thing is a must: plan it very well, and keep building on it, changing and improving it.
For any framework
Pros
get exact functionality you want
control over small details important to your project
familiarity with code
Cons
everything that breaks you must fix yourself
don't get to learn from the mistakes of the past
won't get as many bugs noticed due to smaller audience
Personally I recommend exploring existing frameworks before even considering writing your own. Just remember that it's okay if you don't understand it all in a day!
It's a waste of time. Unless they are building a site with the traffic of Facebook, the performance hits they will get using something like Yii vs. their own should matter very little
It's not necessarily a waste of time but I agree with you, I tried it myself too. I've been using Zend, Code Igniter and Fuel depending on what project that I'm working on.
The consequence that I had in creating my own framework is the deadline. If you're working on a project with a very tight deadline then creating your own framework would be a bad idea.

Should I heed Derek Sivers' warnings about migrating from PHP to Rails? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
As you probably know, Derek Sivers is the guy who created CD Baby and eventually sold it for some big bucks. He wrote it in PHP originally and then down the road set about rewriting it in Rails. His troubles are the stuff of legend:
7 reasons I switched back to PHP after 2 years on Rails
That article came out in 2007 but being newly infatuated with Rails, I'm wondering whether anything has changed to make Rails more of a wise bet in the meantime, or should I stick with my good old ugly PHP girlfriend?
Does anyone agree that Rails does not offer any significant advantages over PHP?
Austin Ziegler wrote an interesting response to that article:
On Derek Siver’s Return to PHP…
The gist of it is:
Derek chose the technology for the wrong reasons. He chose it partially
based on the hype of Rails, but he
envisioned it as a silver bullet that
would magically make his application
better just because it’s in Rails.
Rails didn’t fit Derek’s application model for CD Baby, and
Derek’s application model is more
important than the technology to be
used, since it represents a business
he understands well.
He ignored his existing experts for the new technology. Neither he nor his
employees knew Ruby aside, perhaps,
from playing around with it. This
wasn’t a technology that was deemed to
be appropriate from experience; this
was a technology deemed appropriate by
management (sorry Derek, you might
still be getting your hands dirty with
code, but you’re still management).
Derek approached the project as a whole-environment ground-up rewrite
with a One Big Day deployment, without
considering ways to phase it in over
time. It’s almost always possible to
find interface points where you can
replace one broken piece at a time.
Ultimately, this is what the Rails
folks wouldshould tell you anyway:
replace one area at a time, each with
a different codebase. Interface them
as REST-ful services. Don’t make them
depend on a single database schema.
Re-writing an existing site is almost always a bad idea. It's hard to put your heart into retreading an old wheel. I worked on a rewrite of a site from CGIs to a Java app server and saw several programmers quit because of it. For one, they preferred their old way of doing things and did not want to learn Java. Secondly, I believe they did not have the enthusiasm to re-write a ton of legacy code that they had been maintaining reluctantly to begin with. Far better to try Rails out on a new task and see how it fares. At least then you are putting it on an even footing with PHP in the psychological motivation sweepstakes.
I have experience with PHP & Ruby + Ruby on Rails (earned money using both, but not a lot).
The Ruby library is much better. PHP's library is a collection of functions in a global namespace with inconsistent names and argument order. strpos vs str_repeat. strpos's first argument is the big string and the second argument is the string to find. explode's first argument is the string to split by and the second argument is the big string. This was a big problem for me. I had to look up a lot of things when using PHP, but not when using Ruby. I can remember things because they're consistent. The names of the methods make argument order clear. Another: PHP's strlen($str) vs count($arr) while in Ruby it's just anything.length.
Ruby the language is better than PHP. It has closures, good OO, nice syntax (this is subjective, but you need a lot less punctuation in Ruby, and that's what I get wrong most often).
That's my experience. Try both and see what works for you.
The best answer will be the author's himself. He seems to make another comeback to RoR!:
Foreword
My former company (CD Baby) was one of
the first to loudly switch to Ruby on
Rails, and then even more loudly
switch back to PHP (Google me to read
about the drama). This book by Michael
Hartl came so highly recommended that
I had to try it, and Ruby on Rails
Tutorial is what I used to switch back
to Rails again.
http://railstutorial.org/book
And skimming his own site, indeed, proves his return to RoR:
Instead of trying to teach everyone my unique PHP framework, all
projects will standardize on Rails 3.
http://thoughts.pro/
The guys who changed from Rails to PHP just by following the renowned article of his, now it is your time to come back to Rails, again!
I read that post from Derek Silvers. There is something weird about it. He tells the tale of a project that got out of control, dragged on for months, and eventually had to be abandoned. He blames this on the Rails framework. Yet he never says what it was about Rails that caused the project to fail. The article would be far more credible if he offered some solid information, but he doesn't mention even one specific place where Rails let him down. The closest he comes is to say that their "needs" (?) clashed with Rails's preferences (which ones? How?)
Meanwhile, people all over the world (including myself) are implementing complex Web applications in reasonable amounts of time using Ruby on Rails.
Given the lack of detail, or really any specific technical information at all, in Derek's piece, it could easily be that the project failed for any number of reasons having nothing to do with Rails.
The original question was "should I heed Derek Silvers' warnings about migrating from PHP to Rails?" My answer would be no, his "warnings" amount to a vague anecdote with zero supporting evidence. It is perfectly safe to ignore them.
Should you reimplement a PHP app in Rails? That's another question. There is no blanket answer to that one. It depends entirely on circumstances.
Luke Crawford's recent post about Muxtape offers another perspective.
I spent my first 4 years as a web developer using PHP, and it was fun at the time, but as I began to realize how severely inefficient it was I started looking elsewhere. I’d abandoned my traditional computer science background for the web and its greater design possibilities, but because of this I knew there was a better way. PHP developers shouldn’t be ridiculed as much as they often are because, frankly, it enables people without a more rigorous background to accomplish amazingly technical things. This should satisfy nerds but usually is turned into some kind of weak ‘machismo’ thing instead. Anyways, this dissatisfaction began in late 2004 and Ruby on Rails was brand-new, stable, and addressed every limitation I’d confronted with my old homegrown PHP MVC framework. I’ve exclusively done Rails work ever since.
In any case, it would be hard to defend the categorical statement "Rails does not offer any significant advantages over PHP."
PHP is a great tool to solve certain problems. Rails is a great tool to solve certain problems.
As both an active Rails and PHP developer (with experience going back to 2000), I strongly disagree with the statement.
I maintain that Ruby offers significant advantages over PHP, and Rails is a better framework than anything in the PHP world. A lot of this has to do with the language itself - Ruby can do things that PHP just simply cannot. Once you grok the elegance of meta-programming, a whole new level of expressiveness opens up to you.
Disclaimer: I am by no means a Ruby or Rails expert.
As someone who's been in the industry for nigh on 15 years I see several warning signs that make me nervous about Ruby on Rails specifically. I'm going to ignore the language here because a language is a language. Ruby is a modern language with closures, exceptions, OO, etc. Some criticize it with regards to performance. These issues are largely irrelevant in that they don't impact real world performance (if it takes 300ms to download and display a Web page, who cares that the serverside codes takes 10, 20 or even 30ms to run?) and transitory in that they are fixed in later versions (as seems to be the case with Ruby 1.9).
Ruby on Rails is a closed, heavyweight stack. I mean this as an observation not an accusation. It is tightly integrated (including with Prototype) much like JBoss Seam in the Java world (being integrated tightly with JBoss/Hibernate and yes I know recent releases and articles have tackled the issue of using it with, say, Glassfish and another JPA provider)
This can be both a good thing and a bad thing. J2EE, for example, being a fairly open stack was the cause for much innovation in the software industry in the last decade as almost every piece of it (notably EJB) was replaced by different projects that could be slotted together. And of course it was, if not the birthplace for Spring, it was certainly the incubator.
On the other hand you have more closed stacks like .Net where their closed nature allows for rapid innovation, a model Microsoft has (generally) excelled at. In a few short years DirextX went from being a joke to completely trouncing OpenGL as a games development platform because any closed system can evolve that much faster than an open standards system. That's just how it works.
The other relevant point I'll mention is that in recent years there has been a move towards ORMs ("object-relational mapping") in Java, .Net and elsewhere and this is part of the impetus behind Rails. I've commented on this previously, for example "Using an ORM or plain SQL?" and I won't reiterate those points in their entirety.
As most of you would know there is a mismatch between the object and relational worlds that ORMs have sought to bridge. In the last year or two I've dealt with this mainly through Java (JPA specifically).
Now when you bridge between two things that don't match you end up with "leaky abstractions" (as Joel put it):
All non-trivial abstractions, to some
degree, are leaky.
Now what I'll add is this: there is an inverse relationship between the complexity of the abstraction and how leaky the abstraction is. Case in point: ibatis. Ibatis is an extremely lightweight yet powerful persistence framework for Java and one I'm a huge fan of. It wraps SQL in external files and on top of that puts many modern ORM behaviour, such as:
Lazy-loading of relationships;
Result mapping;
Grouping of results to multiple levels (something JPA can't do); and
Discriminated types (ie the type is determined the data).
I would estimate that ibatis has 90-95% of the functionality of Hibernate with the only complexity overhead being runtime bytecode enhancement for the lazy loading via cglib (JPA does it the same way) with the only downside that you have to write your own queries (and I don't consider that a serious downside but opnions will vary).
Compare that to a JPA provider that relies on instrumentation, load-time weaving and non-standard class loaders to implemennt that extra 5-10% functionality (and the abstraction is still leaky).
So there is a law of diminishing returns when it comes to making things less leaky. At some point you're better off investing in a bilge pump than you are in fixing every leak in the boat.
Bringing this back to Rails: the leaky abstraction argument is my biggest problem with the Rails philosophy.
What also rings alarm bells for me is the comments you get in posts like On Derek Siver’s Return to PHP… is:
"Derek chose the technology for the wrong reasons.": wait... isn't RoR either a general-purpose Web application framework or a pretty close facsimile? That being the case, why can't you do a site like CDbaby in it?
"Rails didn’t fit Derek’s application model for CD Baby": How so?
"He ignored his existing experts for the new technology.": wait... didn't he hire an expert?
"sorry Derek, you might still be getting your hands dirty with code, but you’re still management": I agree with the comment that this quote is "asinine" and will add that its misleading, irrelevant and arguably a strawman;
"Derek approached the project as a whole-environment ground-up rewrite with a One Big Day deployment": arguably not advisable but if you're willing to spend the time and money on it, I don't see it as a reason why you can't do the site in RoR.
Now 5-7 years ago when EJB was hyped up you got criticisms of it based on lots of things and you'd get stalwart defenders arguing:
"Application X didn't fit the EJB model";
"They didn't understand how EJB works";
"EJB is not for all applications" (they'd rather concede defeat on this one than face the more glaring issue that it's not really appropriate let alone a good idea for, well, just about anything);
etc.
So the anti-Ruby posts (and especially their rebuttals) all sound very familiar to me.
It's worth mentioning the year old rant "Rails is a Ghetto" by Zed Shaw, which is a 6000 odd word rant ("conflagration" is probably a better word) against Rails. Some notable quotes:
This is exactly what makes Rails a
ghetto. A bunch of half-trained former
PHP morons who never bother to sit
down and really learn the computer
science they were too good to study in
college.
and
Notice how it took me a few seconds to
reply. This one single statement
basically means that we all got duped.
The main Rails application that DHH
created required restarting _400
times/day. That’s a production
application that can’t stay up for
more than 4 minutes on average.
and (on memory leaks):
That’s one more reason Rails is ghetto
as hell. Important patches like the
above go largely ignored by the
Japanese developers, and while they
are very nice guys, the above just
smacks of amateur hour.
and
The best part about the whole thing is
there’s potentially 10 new web
frameworks that can take on Rails.
Hell, Mongrel spawned or helped 5 of
those. My favorite of those frameworks
is Merb which is literally “Mongrel
plus Erb” but now it uses Erubis
mostly. What I love about Merb is that
it proved you could make a fast thread
safe Ruby web framework with all the
same ideas as Rails and using most of
the Rails gear at the same time.
However, the joke is that before Merb
the Rails Core morons would scream up
and down you can’t make Rails thread
safe. Ezra however proved them all
wrong by just writing a better Rails
than Rails and all thanks to Mongrel
being so easy to hack and work with.
and:
Ruby on Rails has become full of
people like Koz, with Koz the most
senior of the wannabe smarties. Koz
got lucky at best and injected his
shitty coding into a good project,
messed it up, and then latched on to
security as the way to get more
control. Of course he doesn’t actually
know anything about secure coding
which is why his code seems to have
lots of the bugs (go check out the
date parsing shit. Clue: months don’t
always have 30 days).
And, well it goes on.
So I guess I can sum it up this way: Rails smells bad.
Rails is a good framework, but sometimes migrations are bad ideas.
I prefer to start from scratch, you can't be "translating" PHP code into the Rails context. It just can't be done, mostly because of the Ruby language itself and the MVC pattern.
I'd rewrite it in Rails, but if you love PHP, go with PHP. Don't care about what other people say, do whatever suits you.
In business, time is money - and sometimes you have to go the path of least resistance. No environment, language, framework, etc. is perfect. Learn and use what you want to and keep it movin' homeboys!!!!

How to use PHP for large projects? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
The question has been asked: No PHP for large projects? Why not? It's a recurring theme and PHP developers--with some cause--are forced to defend PHP.
All of these questions are valid and there have been some responses but this got me thinking. Based on the principle that you can write good code in any language and bad code in any language, I thought it worth asking a positive rather than negative question. Rather than why you can't, I wanted to ask how you can use PHP for large projects.
So, how do you write a large, complex, scalable, secure and robust PHP application?
EDIT: While I appreciate that the organizational aspects are important, they apply to any large project. What I'm primarily aiming for here is technical guidance and how to deal with common issues of scalability. Using an opcode cache like APC is an obvious starter. Cluster-aware sessions would be another. That's the sort of thing I'm getting at.
For the most part, the problems with php are not so much with the language. The problems come from the coupling of a low barrier of entry and the lack of any infrastructure to avoid common programming problems or security problems. Its a language that, by itself, is pretty quick-and-dirty. Nevertheless, it still has many advantages for large-scale web apps. You'll just need to know how to add in some level of infrastructure to avoid a lot of the common web programming blunders. See - What should a developer know before building a public web site for help with this.
You need to learn about the reasons php can make your web app to be insecure or problematic and learn to mitigate those problems. You should learn about how to use php to securely access your database. You should learn about avoiding SQL injection. You should learn about evil things like register_globals and why you should never ever use them. In short, you should do your homework about your tool before just diving in for a real-world, large-scale, web app.
Once you are educated, it comes down to you'll probably want to build a framework or use a preexisting framework that will mitigate these problems. Popular frameworks include PEAR and Zend.
Also, useful questions that might help:
What should every php programmer know?
What should a developer know before building a public web site
Using PHP for large projects isn't different than with any other language. You need experience and knowledge in writing maintainable and extendable source code. You need to be aware of security pitfalls and performance concerns. You need to have researched your problem domain and be well familiar with it.
In the end, same as any other language - what you need are high-quality and well-motivated developers.
i know, this is a little out of date, but still, i'll tempt an answer ...
use Haxe/PHP ... i could delve into details ... but if you look at the language, its features, and the nice way the PHP API is encapsulated into something rather consistent, you will soon see, what PHPs problems are ... and also, you have all the benefits of Haxe in the end ...
edit: this was a serious answer ... Haxe/PHP automatically solves a lot of problems mentioned in the post flagged as answer ...
register_globals is turned off ... you get your parameters through the php.Web
using the SPOD-layer (same API for php) for the database automatically takes care of escaping (and will automatically provide your model (and templo is quite a good template engine, so that should help for your views))
having a typed language, you are more likely to write better code ... plus language features as generics and enums are very powerful ... and there is a lot of compile time magic in Haxe that is also of interest ... a more powerful language is always good to adress complex problems ...
if you want to use other PHP frameworks, you only need to write the external classes and everything will work as expected ...
i think Haxe is a very good answer to "large", "complex", "secure" and "robust" ... scalability does not come from Haxe itself of course ... but still, if you check out haxelib, then you find many things, that would help for scalability ... such as memcached (you will have to change neko.net.Socket to php.net.Socket in memcached.Connection) ...
if you really want to use the PHP language, and not just the platform, Haxe won't help you of course ...
You do as you would in any other language or any other enviornment.
There are a couple of simple steps in project development:
Organization; You need to organize everything, having documentation, uml diagrams and other pre-work done, before you start programming.
Structure; Before you start coding and also aftter starting, you need to have a focus on structure, meaning that you always need to do it correctly and not do any spagetthi solutions. Keep code simple and well commented.
These two points, are simple and apply in all development areas, despite the language. Keep it simple and well documented and you will find that developing a large scale web app in PHP is as easy as it would be in ASP.NET, Ruby or whatever.
However when we come to the development stage, you need to get a nice IDE, use a good database, use a repo., get an MVC / Template system, this runs in the "Structure"-part though.
Just as a side point, splitting the application into different layers: DLF ( Data, Logic, Front ). Use at least these three layers and you will find that the development will go easy.
Use Model-View-Controller framework. It's been said, yes. And, have at least one engineer for each part.
Model: Your DBA should write the Model code. No should else should be allowed to write SQL statements.
View: The one with the best knowledge of CSS and Javascript should do the view part. He/she should write the least PHP code, he is the one using PHP variables.
Controller: She's the real PHP coder, and also back-end server engineer, hopefully, with or without using other script languages.

Help For The Copy & Paste Generation Of Coders [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I myself am one of these types of coders, who never learned coding in a formal setting, but am instead, self-taught by the use of copy and paste scripts, and pre-authored works available through GPL projects and premium software's(which is often the way commerical script companies show you how to change, or update code in their script ie. "Copy & paste this on line 234, etc..")... this are my beginnings.
I don't understand how what I do works, but I am getting good at what I do with code, though I feel because of my informal learning methods, that I lack in knowledge, some of the really simple, but necessary principles of web coding in general(the ins and outs of servers, browsers, etc). I feel as though I have started from the inside of understanding code, the practical side.. and lack the basic fundamentals, and theorized understanding of what I am doing.
I also know quite a few others who are the same, who started learning in the same communities as I, and are pretty much at the same point as me... Feeling as though something big is missing from the picture.
I see the lacking in my discipline when I attempt to use PHP authoring tools, which I find very challenging to understand... and this is becoming a downfall on the time frames in which I complete my projects(having to hand code everything). I also find it difficult to ask for help at times, for lack of the specific language that comes with programming, and being able to use the right words to explain the intricacy of my problem.
I was a hairdresser by trade, I worked as a bartender, and hotel manager, I'm a business consultant by profession. I've been learning web development slowly now for 3 years, and I have taken on quite a few commercial projects over the past 2 years, but I'm obviously feeling some lacking in my skills & overall knowledge.
Basically, Id like to ask any experienced coders who've had similar beginnings to give me an idea on how I can adapt my coding disciplines to be more effective and productive. What would someone with such an informal understanding of programming want to seek to learn, and understand. What are the things I must know as a programmer... and what is a basic overview of the whole picture???? Feel free to direct me to articles
Any help is always appreciated.
Lea
Edit: Just to give a round up of my actual capabilities. I am a programmer, I do author my own code from scratch.. and sell my work. I can write PHP functions, and classes, use mysql, have a good working understanding of html & css, and am very good in the design aspects(web graphics), and am learning javascript/ajax/jquery, as I am using jquery in most of my projects. Thanks for all of the answers so far!
Realise that "copy and paste programming" is not actually programming, despite the name. The act of "programming" is figuring out how something should work, and what code is needed to make that work. Therefore, when you copy and paste some code, it is someone else who did the programming. This isn't a bad thing necessarily, as you shouldn't always need to write code yourself. But to call yourself a programmer, you do need to have written the code yourself.
You will want to start humble. Don't try to write a large complex application as your first step into programming. There is a good reason why most people who are taught programming are first taught how to print "Hello, world". This is because there is a lot more that you will need to know than just what code to use - you need to know where code execution starts and how it flows, and that sort of thing. You need to be able to look at the code and step through it mentally, knowing where program execution will go next, so you understand how it will work.
Take a tutorial or course in programming. There is so much free stuff online. Do not trust any tutorial that just gives you large chunks of code, make sure it forces you to actually come up with some code yourself. Do exercises such as sorting strings, calculating fibonacci sequences, and the like, and "echo" or "print" the results. Learn about conditional statements (like "if") and the "for" loop and play with these to do various things.
GUI or forms programming is more complicated; make sure you know the fundamentals of the language before you go looking through any API or framework documentation to see what the language can do. You'll need to know how execution flows, how to write functions, what types of variables you can use etc before you can effectively use an API or framework anyway. It is boring not being able to do cool graphics or forms and sticking to basic text or number processing, but you have to walk before running. Make sure you are doing, not just reading. When you learn about something new like the Array type, the "while" statement, try it out. By actually doing it, you'll "get it" a lot faster than just reading a book or website and you may be more likely to remember it.
Read books about programming. Some people say you should learn C before you learn anything else. I don't necessarily agree, but if you do learn C then the book to read is "The C Programming Language" by Kernighan and Ritchie. Many programming books are very interesting but either not suitable for beginners, or aren't going to teach you how to actually begin programming. This one is an exception.
Use a decent text editor with syntax highlighting and line numbering. That's all you should need. A big IDE that also does code completion and the like is not necessarily helpful at the learning stage. Don't spend too long choosing one or setting it up. If you don't already have one, just get Notepad++ (if you're on Windows) and be done with it. If you don't like it you can change it once you get more proficient. Or if you've already paid for Microsoft Visual Studio then use that, but don't go out and get it just for the sake of learning a language. Avoid falling into the trap of spending all your time sharpening your tools and no time using them.
The easiest and fastest way to do this? Find a mentor, or a set of mentors. Not necessarily a real-life mentor, they can be offline, although a real-life mentor is more practical.
You can find these people when you participate in local software development communities, e.g., forums, or user group meetings. Frequent these places, both offline and online; the amount of knowledge that you will learn is immense, not to mention the benefit of being able to bounce ideas off of other people.
Code Complete and Pragmatic Programmer are likewise excellent book suggestions above. I suggest you go with Code Complete first, as it tackles on how to make your code sensible and elegant, which you certainly can use immediately.
Goodluck!
We all learn differently, so don't feel handicapped because of the way you've entered the field.
I guess the simplest, easiest thing I can suggest would be to get yourself a PHP book (seeing as that's what you're familiar with right now) and start from there to build up confidence.
In your spare time, just create some very small basic apps to practice without any pressure. Then take on a language like Python, Java or .NET.. depending on what takes your fancy. With a language or two under your belt, then you can take on books like Code Complete, which will cover some of the more esoteric areas of software development.
Good luck, this is a profession where you really never stop learning.
in case you're interested to becoming a better programmer, i must recommend that you read the pragmatic programmer, don't worry, it's not a full text of codes which will make you pull your hair out but useful lessons which can only be distilled from years of programming experience written in an easy to read but still very informative kind of way :)
I'm not at all convinced that the premise of the "Copy & Paste Generation" is any kind of new phenomenon. Only the tools are available to a wider audience now than before.
If you want to really hone your skills, it might be worthwhile to take some classes, either at a local community college or in a self-directed learning environment through the use of some of the many, fine online resources or books
I believe Code Complete is another book along the same lines of the Pragmatic Programmer that has already been recommended.
I have been your situation before, senior year of high school in an internship I "learned" c and shell programming mostly via copy and paste, and later on at various times when I may have been in a similar situation with specific technologies.
My recommendations:
Take a class at your CC. The one you want is the one that is the prerequisite for the advanced programming classes. They probably also offer a "I've never touched a computer before" level class but this one won't be the formal prereq for the follow on classes. This will probably be in Java.
Work your way through one of the better programming books that includes exercises. Kernighan and Ritchie's C Programming Language is a classic. This would be my recommendation because C is similar enough to PHP to be familiar, but different enough that you will be able to keep them separate. I say this even though you will probably never write a single line of production C. Paul Graham's ANSI Common Lisp is also a suitable choice.
If you are really hard core and have the dedication, you can try Structure and Interpretation of Computer Programs, by Abelson and Sussman. This is the book used in the first programming course at UC Berkeley ( http://webcast.berkeley.edu/course_details.php?seriesid=1906978389 ) and at MIT ( http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/CourseHome/ ). This may be too difficult to attempt outside a school environment. It's designed for bright young students with nothing to do but study and with the regular opportunity to get tutoring from grad students. I include it only for completeness.
I would avoid any web programming books. You already know web programming. I get the impression that you are feeling like you are hitting a bit of a wall, and looking at a way around or over that wall, rather than trying to go directly through it.
I would advise against looking into any web oriented book because it will not give you the big picture, it will describe technique only as they apply to web programming. The important things to understand are how a computer actually operates, the difference between the stack and the heap, pointers, the basics of garbage collection, recursion, and it'd probably be helpful to understand at least extension mechanism. I mean, if you understand shared libraries on Unix, or DLLs on Windows, or classpath and jars on Java, or how to create a library in PHP, Ruby, Perl or Python, any one of those will be fine. It's just the concept of loading outside code that's important.
Take a look at The Structure and Interpretation of Computer Programs and see if you think it would help.
Copy and paste programming refers to using the same code several places instead of putting it in a function or class. If all you do is modify existing source code while following a howto guide, what you do is not called programming, just copy and paste.
What you need to do is read a book on programming, whatever you feel your level is. If you feel its copy and paste level, you should start with a beginners book. Forget everything you think you know, read and follow the book. When you've finished you can remember some of the clever code(?) you noticed during your C&P days.
Mastering any skill takes time, but if you keep at it you'll become better. There is nothing inherently different about programming in that sense. Exactly how you learn best, is a highly individual matter, so it's really hard to give any meaningful advice on that. In my experience, combining different types of learning (practical experience, being around other programmers, reading books, formal education etc. etc.) in even-sized doses works better than just pursuing one type of learning (Such as formal education).
You might find these readings interesting, if you don't know them already:
http://www.norvig.com/21-days.html
http://softwarecraftsmanship.oreilly.com/wiki

How to sell Python to a client/boss/person [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
When asked to create system XYZ and you ask to do it in Python over PHP or Ruby, what are the main features you can mention when they require you to explain it?
This is one of those cases that really boil down to personal preference or situational details. If you're more comfortable and experienced with Python, then say so. Are they asking you to justify it because they're more comfortable with one of the other environments? After you're done, will the system be passed off to someone else for long-term maintenance?
If they ask you to use a technology or language that you're not as familiar with, then make sure they know up-front that it's going to take you longer.
The best sell of Python I've ever seen was by a manager in our group who had a young daughter. He used a quote attributed to Einstein:
If you can't explain something to a six-year-old, you really don't understand it yourself.
The next few slides of his presentation demonstrated how he was able to teach his young daughter some basic Python in less than 30 minutes, with examples of the code she wrote and an explanation of what it did.
He ended the presentation with a picture of his daughter and her quote "Programming is fun!"
I would focus on Python's user friendliness and wealth of libraries and frameworks. There are also a lot of little libraries that you might not get in other languages, and would have to write yourself (i.e. How a C++ developer writes Python).
Good luck!
It's one of the preferred languages over at Google - It's several years ahead of Ruby in terms of "maturity" (what ever that really means - but managers like that). Since it's prefered by Google you can also run it on the Google App Engine.
Mircosoft is also embracing Python, and will have a v2.0 of IronPython coming out shortly. They are working on a Ruby implementation as well, but the Python version is way ahead, and is actually "ready for primetime". That give you the possibility for easy integration with .NET code, as well as being able to write client side RIAs in Python when Silverlight 2 ships.
Focus on the shorter time needed for development/prototype and possibly easier maintenance (none of this may apply against Ruby).
I would consider that using python on a new project is completely dependent on what problem you are trying to solve with python. If you want someone to agree with you that you should use python, then show them how python's features apply specifically to that problem.
In the case of web development with python, talk about WSGI and other web libraries and frameworks you could use that would make your life easier. One note for python is that most of the frameworks for python web development can be plugged right into any current project. With ruby on rails, you're practically working in a DSL that anyone who uses your project will have to learn. If they know python, then they can figure out what you are doing with django, etc in a day.
I'm only talking about web development because it appears that's what you are going to be working on seeing ruby, python and PHP in the same list. The real message that's important is applying to whatever it is you like about python directly to some problem you are trying to solve.
Give them a snippet of code in each (no more than a page) that performs some cool function that they will like. (e.g show outliers in a data set).
Show them each page. One in PHP, Ruby and Python.
Ask them which they find easiest to understand/read.
Tell them thats why you want to use Python. It's easier to read if you've not written it, more manageable, less buggy and quicker to build features because it is the most elegant (pythonic)
I agree with mreggen. Tell them by working in Python you can get things done faster. Getting things done faster possibly means money saved by the client. In the least it means that you are working with a language you a more comfortable in, meaning faster development, debugging, and refactoring time. There will be less time spent looking up documentation on what function to use to find the length of a string, etc.
Though All 3 languages are versatile and used worldwide by programmers, Python still have some advantages over the other two. Like From my personal experience :-
Non-programmers love it (most of 'em choose Python as their first computer language,check this infographic php vs python vs ruby here)
Multiple frameworks (You can automate your system tasks, can develop apps for web and windows/mac/android OSes)
Making OpenCV apps easily than MATLAB
Testing done easy (you can work on Selenium for all kind of web testing)
OOPS concepts are followed by most languages now , so how come Python can stay behind! Inheritance, Abstraction and Encapsulation are followed by Python as well.
Python as of now is divided into two versions popularly that are not much different in terms of performance but features. Python2.x and Python 3.x both have same syntax ,except for some statements like :-
print "..." in Python2.x and print() in Python3.x
raw_input() in Python2.x and input() in Python3.x (for getting user input)
In the end, client only cares about money and Python helps you save a lot as compared to PHP and Ruby , because instead of hiring experienced programmers , you can make a newbie learn and use Python expertly.

Categories