General programming knowledge? - php

I am completely new to programming - my interest lies in PHP & MySql for building a dynamic web application for Military Band Administration purposes. i.e. General info and social networking for members + added functionality for the management team to communicate effectively.
OK so the question - as I learn more about PHP there are terms used that I do not understand that must come from a common basis of familiarity between all languages i.e. "stack overflow" appears to be an obvious one - "using too many recursive functions may smash the stack" is another.
So is there a book (a primer perhaps) about programming in general which allows someone like me to have a better understanding of what all this means?
Bear in mind I am 57 years old (young) and am really just starting out.
Steve

Wikipedia is probably your best resource for general information on programming terminology. A large segment of their community overlaps with the programming community, so tech-related pages are normally very accurate, educational, and up to date. See their pages on stack overflows and recursion as examples.
Also, PHP.net is the best place to learn about PHP specifically, but skip the main page and go straight to the tutorial if you're just starting out.
Finally, I highly recommend the book Head First SQL for learning about databases. All of the examples in the book use MySQL. The entire Head First series is great. I hear they have a PHP book as well, but I haven't read that one.
Update: Head First PHP & MySQL is now available.

It sounds like you're missing some of the fundamentals covered in a computer science program. Not to worry, the information is readily available. You don't have to pay someone to teach it (though it's sometimes nice). Wikipedia's computer science entry isn't too bad for highlighting the major fields you're likely to encounter. Topics that are good to know:
Discrete math (Helps to understand formal logic, algorithmic complexity, probability)
Programming fundamentals (sounds like you may have a good start on these)
Data structures (Store and manipulate your data in an appropriate way for a task. For instance, why use a hashtable versus an array versus a linked list? From your list, the stack in a stackoverflow is a data structure.)
Algorithms (Manipulate your data structures in the most efficient way possible or at least know the cost. From your list, using too many recursive functions to "smash the stack" is an algorithmic choice.)
Computer Architecture (Understand what's really happening to your code after it's compiled or interpreted.)
Networks (Learn protocols, what happens to your software when it wants to talk to a machine it's not running on)
Comparative Programming Languages (PHP is just one way to skin a cat. Learn why its designers made the decisions they did and gain exposure to alternatives.)
Operating Systems (Knowing how hardware interacts with your software is good but it's probably more important to understand how it interacts with its operating system. File systems, process management, memory management, security)
Formal Languages/Theory of computation (Models of computing, grammars [used to validate and interpret code], limits of computing. Typically not used day to day as a software engineer. Then again, regular expressions finally made sense after this class.)
Software Design and Life cycle Methodologies (Be deliberate about designing, coding, testing, releasing, and maintaining your software.)
As far as books, I'd start by checking a trusted school's computer science program reading.
Stanford offers a set of classes online for free: http://see.stanford.edu/see/courses.aspx
MIT lets you download course materials for free: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/
Check youtube for computer science related lectures.
If you want something less school-focused, a quick search on Amazon with any of the topics above will give you results with user reviews.
Obviously, taken together, this list isn't really an introduction. I'd start with a topic that sounds interesting and jump in.

Well it is not book about PHP but I think a book like "Learn to program" from the Pragmatic Bookshelf
might be useful for someone in your situation.

To get a good understanding of the inner workings of computer hardware and software in a very readable (not too technical) manner, I can recommend Code,The Hidden Language of Computer Hardware and Software by Charles Petzold.
The later chapters in particular talk about some of these more general programming concepts that are present in most programming languages. The earlier chapters focus on more the history of the computer and software, so not as relevant to your question.
However it's not a large book so the reading it all should be interesting/useful anyway.
There are better books if you are looking for an introduction to PHP/MySQL programming specifically, however if you want more general knowledge about how software and hardware works, Code is great.

I'm not sure if there's one book that'll teach you "The Fundamentals of Programming." The only way I know of learning all these things is simply practice. Get a PHP tutorial and start building things. Always keep your mind open to learning new things. When you find a better way to do something than a likely very inefficient hack you put together from incomplete knowledge, then use it and learn it and integrate it into your knowledge... after a few years of this you'll be golden.

It's been a couple years since I read it, but Programming PHP did a nice job of introducing the fundamental programming concepts along the way. It didn't do much for helping understand more advanced concepts, like MVC (which is rare in the PHP world), it things like arrays, functions, callbacks, classes, etc, where covered.

I like Corbin's comment, but I'll take the opposite approach.
Basically, with systems today, you really don't need to know all of the low level details of systems. Really, you don't.
If you find this stuff interesting, the entire internet is at your disposal -- and simply let you inner muse guide you through either necessity or simple curiousity. You can go as deep or as high as you want.
The truth is, computing today is simply SO fabulous that the project you want to embark upon is just a perfect opportunity to learn more about the arcane world of computing. The fact that folks can get as far as they can "without having a clue" is testament to how far the field has advanced. It's a good thing.
Is it a good thing to understand the process soup to nuts? Sure. Do you actually NEED that understanding to be productive and get useful results out of your time investment? No, you don't.
And, as you progress, if you actually enjoy this work (you well may not), the field goes as broad as you want.
Computing today is like "Home Depot". You can do it, we can help. There are hundreds of forums and thousands of pages of documentation, books, blogs, and discussion available for most any topic.
The key thing to focus on is simply getting your task done. Don't worry about getting it perfect, don't worry about "doing it the right way", don't "engineer" it. Just hammer bits together until you get something close to resembling what you want to get done using whatever you happen to find or intuit yourself. Because that's the easiest way to find out what you don't know, and how to not do things in your application. Try it and see.
You will be blinded by options, techniques, patterns, frameworks, etc. Not only is there "more than one way to do it", there are HUNDREDS of ways "to do it". Ignore the hundreds, and focus on the "doing it", however seems natural to you.
And don't let the yahoo's in their ivory towers poo-poo your questions, or shred your design. Unless their name is "Babbage" or they were cutting gears for the artillery computers back in WWII, we're all standing on the shoulders of giants here, and we all started somewhere. Honest criticism should always be welcome, but some folks seem to be beyond being able to offer that and instead resort to belittling.
I marvel at the applications I've seen "hacked", "butchered" and "OMG'd" together that folks get real, practical use out of -- and that's the real name of the game.
Good luck on your journey. Success in all your endeavors.

Learning is quite individual, so your mileage may vary, but I find that asking questions in public fora is very helpful. If you don't know a lot of the topic it's easy to ask the wrong questions, or somehow focus on the wrong things. Getting direct feedback from someone more experienced usually helps with that. PHP is blessed in that it has a very large and friendly community. Further, a lot of its users are amateurs or inexperienced programmers, which means that there is a culture of asking basic questions about terminology and the like. I suggest that you tap into this source.
One place to start could be at sitepoint, but there are other places

If you're more of a visual learner I would check out some video tutorials. Start with things like basic programming concepts and then move up to titles like Up and Running with PHP and Advanced PHP and MySQL. Then I'd suggest an MVC framework like codeigniter.
You can find great video tutorials on Lynda.com or Pluralsight.com and several other places.

Related

Is there a high-level language for the web?

Preamble
To build dynamic web-sites, we have to master at least four languages:
HTML for the structure of web pages
CSS for layout and design
JavaScript for interactivity
A language for business rules or dynamic driven data
In addition, there's SQL for persistent storage, Memcache for sessions and caching, APIs for the many different content management systems. We should also consider interacting with OpenID, Facebook, Twitter, OpenSocial in building a web application, for it to be interesting.
All in all, it's an utter mess!
If you take into account two objectives:
Teaching web development to kids
Staying productive as a team
Question
What high level systems exist that unify HTML + CSS + Javascript + (Insert High Level Language here, PHP preferred)?
Background
I am a software engineer with 15+ years of experience as project lead and developer with technologies like Broadvision, Autonomy, Enterprise Java, and Oracle.
During recent years, I have focused on the developing community websites, using Drupal or PHP frameworks such as CakePHP. I like web development and enjoy the impedance mismatch between the technologies involved. Still the inevitable conclusion I come to is there must be a better way.
I am the father of two sons (13 and 9), and while I don't want them to become programmers I would like them to comprehend computers as more than gaming machines. I like to motivate them to tinker a bit with web development to express themselves.
Whenever I show them bits and pieces, I would love for them to have a toolset that allows them to create "interesting" results in an hour or two on a Sunday afternoon.
GWT goes someway towards being a high level toolkit, letting you write Java to produce Javascript.
"Links is a new programming language designed to make web programming easier. . . Links eases the impedance mismatch problem by providing a single language for all three tiers. The system generates code for each tier; for instance, translating some code into Javascript for the browser, some into a bytecode for the server, and some into SQL for the database."
At first I wasn't going to post this, since it's a research project, not a production system; but all these answers saying "that's how it is, deal with it" begged for a counterexample.
Web programming is an inherently multi-discipline craft.
The primary reason for this is because of seperation of concerns...the reason that HTML and CSS and JavaScript, SQL, etc, are not mashed together in one language is because they each have seperate goals, caveats, pitfalls, and strengths.
Can you imagine trying to debug a site that has SQL, CSS, JavaScript and PHP code mixed together in the same source files? You may have already had the misfortune of doing so. Sadly, there are literally thousands of sites written like this, and it is a complete nightmare trying to debug or add to such messy amalgamations of presentation, data, and structure.
All in all, an utter mess! How is one
supposed to teach web development to
kids?
I think the most important thing is teaching the fundamentals of programming and making them stick. Variables, logic, pointers, memory management, algorithms, data structures, etc.
When you have the fundamentals of programming, it's easy to work in multipe languages, pick up new ones, and easy to change with the times. This is an invaluable skill for something as constantly-evolving and trend-based as web programming.
In my opinion people new to programming should be started at lower level languages, like C for example. People should be tought the intrinsic, fundamental concepts of programming and should gain knowledge of what is going on behind the scenes before even being shown a higher level language like PHP or Python.
I think that this attitude towards teaching programming will have the effect of breeding better web developers as well as providing a barrier of entry that will weed out people that don't have the interest or intelligence. I think the result of this type of attitude will be better developers, better software, and ultimately more powerful languages and tools.
How is one supposed to teach web development to kids?
An army of kids in web development is what has degraded our profession since now just about anyone calls himself a programmer while it's getting harder and harder for us to get distanced from them and get decent pay.
Many languages and technologies to master? It's a good thing. Let there be some entry barrier to join the ranks of developers.
ADDED: By following comments I can see I have not made myself entirely clear. I say nothing about the age, be it 10, 30, 50 or 80. It's all about attitude. Whether a person understands and accepts the fact that there is much more to the profession than moving controls with a mouse in some designer or CMS. There is a lot of knowledge to be gained, including basics of CS, algorithms, data structures, databases, architecture, extensibility, maintenance, performance, scalability, usability, marketing and much more that belong to the workshop of a professional software developer. I a person is ignorant of those and doesn't make a move to educate themselves and strive to become more and more proficient, they do not belong to the profession. And let this opinion be biased.
The closest I think you'll get is .NET. There are many frameworks for many languages, but none that I know of that handle absolutely everything. Beside that you must not attempt to convince children that programming is a walk in the park. It's a difficult career, that requires a lot of study and keeping-up. We work with technologies that are here today, and gone tomorrow.
If you think about it, programming isn't any different than carpentry, or aeronautics. Just about any profession you chose will require you to learn a lot of different things to be better at what you do.
How are you supposed to teach web development to kids? Wow, that's a thorny one. How does one go about teaching them surgery, or intellectual property law, or civil engineering? Or for that matter auto mechanics, or plumbing, or general contracting?
Have you thought about popping in a Sesame Street tape?
Elmo doesn't like it when you trivialize his profession.
Software industry is suffering from unqualified individuals doing nothing but creating poor quality products and at the same time distancing this profession from becoming a true engineering discipline. This isn't something to get certified on. For the love of god, don't 'teach' anyone software development. Explain to them that making great software only comes out as a result of years of experience and wealth of knowledge of past and current technologies. The worst you can do is introduce yet another half-baked developer creating work for others working with them. Tell them to get educated. I know this isn't the answer you probably wanted to hear, but I wanted this to be read.
I think the problem with web development is that it was not originally designed for what it is used today. We build rich client applications inside a browser with HTML+CSS+JavaScript plus whatever serverside technology generates it. Yes, it works, but it's a pain, especially with those annoying browser incompatibilites. The existence of Flash and Silverlight proves this. They let you build your app with one single technology, still inside the browser. The downsides of needing a plugin for your content is obvious though.
The languages are the least of your worries. It's the problem domain that they work with that is complex. Using different languages actually makes things more manageable because a) It makes the boundaries explicit and b) the languages can be optimised for the domain.
Programming (PHP/JS) and document format (HTML/CSS) are 2 different things.
Learning to program in PHP and JS at the same time will also be difficult.
You should focus on HTML and JS on the client at start. You could then let them program javascript on the server as well. This will make it only one programming language, and focus on HTML over CSS to start with.
Once they've learned the basics of JS and HTML, you can teach them a more widely used server side programming language (like PHP, Ruby, etc) and CSS.
Django can take you part of the way through its cleanness. It is focused around productivity. Teaching is not easier than any other language/framework, but look at it this way: when taught this tool, your students are well equipped in their knowledge of how easy it should be. They will never accept Java servelets or similar nightmares after having learnt Django.
Check out Opa: http://opalang.org/
This is an up and coming web development technology. It looks quite promising. I have done a lot of web development over the past couple years and if I had to make a prediction which up and new framework/language/technology is going to be the primary way websites are developed in ~5-10 years I would say it will be Opa.
The documentation is great, the community is great, the tutorials and responsiveness to questions asked of the team working on the project is excellent. Overall they seem to have an attention to detail in regards to developing this new framework that seems to be unmatched.
Many technologies to master is not a good thing. We need a Visual Basic for the web, no matter what the elitists say.
You need different languages for different purposes. In most web applications there's actually quite a bit going on, so you need the different languages and solutions.
If the goal is to unify on a single language, you can do that. You can use Javascript on the server, and then build the pages using document.createElement() and apply styles to them directly to the styles property. And on the server, store your data directly in files with Javascript.
Obviously this wouldn't work out that well. HTML is not perfect, but there is a reason it is so ubiquitous-- it does what it does simply and well. CSS is both convoluted and too simplistic, but the underlying idea of defining overrideable rules to express your design is sound. And SQL may be a pain to understand at times, but expressing database queries this way is expressive and actually works pretty well.
That being said, I'm not saying there is or should be one architecture. There shouldn't be. Each project should use an architecture in line with its requirements.
On your next project try to simplify: do you really need a database? Can you combine the view layers to simplify, either using something like GWT, Applets, Flash or .NET? Do you really need to serve up your content in a browser (which introduces CSS, HTML and Javascript complexities), or can you just write an application?
I think your approach might need to be rethought. Take this for what it is, my opinion, but I would think this ordering might work better.
Top Priorities: (no particular order)
Develop problem solving skills
Be productive as a team
Next:
Basic Programming skills (PHP, Python, etc)
After they know how to solve problems as individuals and as a team they can move onto specifics such as:
Client/Server model
Markup (HTML, XHTML, XML, etc)
Styling (CSS)
Client-side scripting (JavaScript / jQuery)
Server-side scripting (PHP, Ruby, etc)
Build up their knowledge of what's involved piece by piece rather than jumping into the deep end off the bat - they'll be quickly overwhelmed.
At this point you can start to introduce things like file I/O and databases.
This will give them a fairly comprehensive skill-set. From here they can really start learning.
In addition, one may have to deal with SQL for persistent storage, Memcache for sessions and caching, APIs of content management systems, OpenID, Facebook, Twitter, OpenSocial etc. to build anything interesting.
These are whole topics unto themselves, you can't bite them off all in one chunk. Especially if you're taking these people from 0. Before you can build something interesting you have to learn to build something mundane.
HTML5 will probably be more in the vein of what you're looking rather than Flash or Silverlight but it's not quite here yet...Though support is building.
Baby steps, Olav - if this were The Matrix you could download all that info in one shot but we're not there...yet ;-)
For the moment, and near future, web development is the synergy of many different technologies working together to deliver an interesting user experience.
Well, that's my 2 cents
The multi disciplinary nature of web development is one of the things that makes it a joy to work in, especially in a team environment.
To work well as a team, you naturally come together with a group of people with a range of expertise, from UI/graphics people down to DBAs and sys admins. Even within a single layer of the group (for example back end programmers) each person generally specialises in a different set, for example some people may have more experience up towards UI, others down towards data.
I would take this variety any day, compared to working in a room of 10 java programmers all working on some middleware application.
If you simply want to teach them to write dynamic websites, set them going through the HTML tutorial on w3schools.com and once they're done, find yourself a decent looking stylesheet that they can include and set them going with PHP. That'll get them up and running as a hobby, and if they want to do more, they can start piecing together extra knowledge, like CSS and JavaScript.
Ruby on Rails goes quite a way towards unifying all of those, but for CSS it leaves you out in the cold (though there are probably a few frameworks for RoR that make CSS obsolete, but then you have another markup language, I think), and you still need Javascript (though it does write a lot of Javascript for you, and all DB code).
On the other hand, about your kids: programming is for programmers. On a Sunday afternoon to put something together in a few hours, you would need to know a framework, and buy some plugins, and get everything up and moving without much work. Something like Drupal or Joomla, where they sell templates (for Joomla you can buy packs of hundreds) and plugins to do all kinds of things. And when that fails, your kids should probably know how to go on ODesk and drop $100 to get something done on your framework. Learning to programming is good if you want to be a programmer. Otherwise, it's best to learn what you need to hire good programmers or buy good predone components, and have the cash to do it.
Last point about the kids: let them play video games. That is the best training that they can get for whatever the future holds in store on the computer side. Video games let you investigate, play, and relax with the computer. Once you have that, learning HTML, CSS, Javascript, and some application stack is cake.
angularjs could be an option. it is inteded for single-page-applications and runs on a nodejs-stack and does some template-javascript "magic".
example (template/code):
It binds(via auto-generated-client-side-js) the value from the input-field to the the heading(h1).
If you type something to the input field, the text in the heading gets updated.
And you don't have to write the frontend-js.
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<h1>Hello {{yourName}}!</h1>

Staying consistent when working with large scale projects

Probably a bit off topic question, but it's something I'm really interested in getting to know from other people with different experience and backgrounds.
How do you keep track of your huge projects? Do you use subversion? EER-models? Do you write notes? Does all your faith lie in phpdoc? Which framework do you use, and which design pattern do you follow? A lot of questions, I know, and I don't expect you to answer ALL of them, just summarize whatever you want to emphasize the most.
Personally, I use subversion for source control, phpdoc, writing down personal notes for each model/controller etc and I'm almost always following the MVC-pattern.
Have a fantastic and automagic day! ;-)
I would recommend on using the tools that work best for the people that you have, and the parts that are likely to be the most difficult to manage.
If you have a lot of requirements, use a tool which tracks requirements well.
If you have a lot of simple one-off projects, maybe simple project tracking works well.
A great way to document your project (especially the high level stuff) is to have a wiki. The success of that obviously depends entirely on your teammates. If they hate writing prose then the whole idea is basically doomed from the start.
But given the right people it can really pay off. A few wiki pages with a couple of diagrams can go a long way and oftentimes be way more expressive than any UML diagram and what-have-you (of course, the combination of both is even better :-) If you can get your testers and other people to join in, you're off to a good start. The more, the merrier.
One thing you forgot to mention in your post is a bug tracker. That is an absolute must-have, I am sure Joel has some good tips on which is the best software choice there ;)
You should a bug tracking software to record how each issue was resolve and tie it to your Subversion Repository so that you can see the issue that generated the check-in and the vice-versa. We use Fogbugz ourselves.

What would be a good sample project to ask a prospective programmer to code during the hiring process?

My understanding is that asking for a work sample is a good way to determine if someone has the skillset you are looking for, as some people just interview well. So I want to ask potential developers to write some sample code for me.
I'm looking for ideas on what kind of small project would be something they could do in an hour or two, and would show that they have a good grasp of OOP, good coding practices, etc. And what to look for once they finish - how to evaluate it fairly and usefully.
For context, I'm a small business owner, interviewing prospective developers, for PHP development on internal projects. I can code PHP but am not an expert (some of the work is refactoring code I've written to be better structured and consistent), and so I'm also looking for what to look for when evaluating the samples, given that I'm not a trained or super experienced programmer.
Especially for people who have done hiring of this type before and used this method.
I was also thinking I could give them some code to refactor, and see how they do on it. Has anyone ever given a refactoring test as part of the hiring process?
Clarification:
I'm not talking about coding during an interview. I'm talking about coding instead of an interview. For context the inspiration for this question came from this article in FastCompany about how work samples are better predictors of job success than interviews:
Why It May Be Wiser To Hire People Without Meeting Them
http://www.fastcompany.com/magazine/136/made-to-stick-hold-the-interview.html
I would create a not necessarily good application and embed some bugs. I would come up with some simple functionality to be added to the program.
Does the applicant find some bugs?
How does the applicant's code integrate into the existing code?
Does the applicant get stuck on something that doesn't really matter?
Does the applicant adapt to the coding standard of the existing code?
After this exercise, discuss the code with the applicant. This may be more valuable than the actual code.
NOTE: with regards to #bpapa answer I would make sure that problem is novel and obviously not to be used in production.
Personally I would refuse to do this when asked. An interview is one thing, and doing programming questions on paper to asses technical knowledge is fine, but actually writing some kind of application for somebody is billable and I wouldn't do it for free. Even if it only is supposed to take an hour.
I think you should focus more on what the person has done in the past, and ask technical questions that you know the answers to (since you said you have limited PHP knowledge and want a PHP developer).
I would heed Joel's advice that giving homework assignments for interviews just weeds out the best programmers (paraphrased from his book). The better programmers have a lot of options and so won't want to go through the exercise of a programming assignment. They just won't apply. That will leave you with the mid-competency people. Unfortunately, in my experience those are the ones most likely to try to look better than they are and if you aren't an expert yourself, the ones most likely to mislead you.
Here's an alternate option. Have them point you at some work they have already done. Not necessarily the code, but the site. During the interview, ask them questions about how they coded it. What data structures did they use? How were the classes or functions organized? What problems did they have to overcome?
Then as traditional programming questions in the interview that they could answer for you ont he spot. This way you can gauge their understanding and their syntax. The two don't have to be the same question.
If you are not an expert then I would suggest you be careful about trying to evaluate other developers. You should probably figure out a better way to assess the dev skills of someone else if you are not that comfortable with your own level.
I am not sure there is a good solution for you.
I'd make the coding samples very straightforward and not have it take an hour or two. Simple coding exercises that take a few minutes should be sufficient - combined with other discussions about best practices, frameworks, design questions, etc.
I like the problems at streamtech. They are pretty easy and can often be done in rather short time, but they show that the applicant is capable of structured thinking and translating this to structured code.
As for evaluation---I would use this as an opportunity to learn. Do the problem yourself first, then compare to the applicant's code. Look up any constructs that you don't know, then ask yourself which version is more obviously correct.
I think the best thing you can do is try to have a real expert sit in on the interview with you. Hire a third party if you need to. I'm not sure it's possible to be able to give a quality assessment of someone who is a more experienced developer than yourself.
The other thing to consider is that really good developers may pick up on the fact that they are more experienced than yourself, and if you indicate that you are one of the developers it may actually put them off (not trying to be offensive, I just mean in the context of you implying that you are not very experienced.)
Give them an address or such as a plain text file and ask them to create a simple script to turn it into XML. I used that once and it worked wonders.
If you want to test them on the spot, ask them to reverse a string. From an organisational standpoint, perseverance, determination and enthusiasm are just as important as being technically adept, IMHO.
Well, everyone seems to be discouraging the coding effort for an interveiw. I'll disagree with the disagreers. To answer your question--if you want an example of what to have them code--drop a simple calculator on the table in front of them and ask them to write a program to create the calculator virtually. Give them half and hour and see how far they get. Some may finish in that time.
Have you ever tried pair programming before? Two people sit down at one machine, they share keyboard and mouse, and talk about what they're doing as they go. I think this is absolutely the best approach, because it will, eventually (after everyone's panic subsides), really indicate how well you two work together.
If you're not a great programmer, this person should be able to teach you and put you at ease. If they're not that good, but you work together well, that might be more desirable than a brilliant but unpleasant person.
At the end of the session, just delete your work. No big deal.
I've never been a part of the hiring process... but in interviews I've done, I was asked once to implement a doubly linked list, and another to work out an algorithm, the classic, how many integer points within a given shape, in this case three points forming a triangle, once in O(n^2) and then again in O(n).
I don't think the way to do it is to make them program something, but to make sure they know how to figure it out. You give them a problem or ask them a question, and tell them to think out loud, and observe their thought process. This doesn't exactly show if they have clean code, but depending on the problem it gives you insight as to wether or not they know what their talking about.
Having a small, well defined task can help you take examine people on a level playing field with a relatively small investment of time on their part. You don't need something complicated to see what people can do.
In the past, I've asked people to write a small web application that exercises a few fundamental concepts. We keep the particulars of what the application is supposed to do really simple.
I would also try to avoid tasks that require a lot of supplemental knowledge (viz, don't ask them to solve a problem from your particular problem domain).
Edit:
Regarding "small, well defined tasks": What I try to shoot for is something that includes a very thorough description of some simple business logic as part of a larger programming task. For example, one of the programming assignments I've given in the past involves setting up a simple Java web application and implementing a few features. We made sure to describe thoroughly how the features were supposed to work to remove ambiguity. This was for a couple reasons:
The point is really to see if the candidate can build a simple application from scratch, not to see whether they can guess correctly about what we want.
If you define the task really well, you get to see more about how thorough someone is with the type of work that they're likely to be doing in a business situation.
We wanted something flexible enough to give to candidates at varying levels of experience.
I should note here that I think programming assignments are most effectively used to check for competency. If you give a really hard assignment, or one that isn't well-defined, odds are that you're not going to get results that tell you what you want to know (unless you're testing specifically for how the candidate handles difficult assignments or ambiguity).
I argree with bpapa about it being an interview instead of a test run, maybe instead consider asking some questions about how they would undergo certain talks to do with the programming...
I once had to sit a Visual Basic MCP exam at the end of which they didn't even bother to give me the result.
Happily though when I asked the question as to whether I would be given the result I was sitting at the Commit/Cancel screen.
So I hit cancel thanked them for wasting my time and walked out.
To answer the question:
For PHP, I think a shopping cart, address book and forum would be good projects. Those usually cover a wide spectrum of web-programming topics - sessions, registration, database, form processing and authentication.
Personally speaking:
It looks like you looking more of an architecture person than a coding guru. I wouldn't penalize the applicant because he cannot come up with the name of an obscure function or need to refer elsewhere. The key thing is that he has the initiative and know where to look (heaven knows how many times I need to look up PHP.NET). A good question for an architecture guy, IMHO, is to tell him you have a data-set, but you have three different ways of displaying them and each view has different operations. If his answer is just a gigantic SWITCH-CASE, then he may be the wrong choice.
Usually weak programmers does not understand recursion pretty well, that's from my observations as far as now, now this does not have anything to do with PHP directly and probably a recursive factorial or fibonacci series wouldn't be a big deal, but let's say to load a tree control with data from a database with some parent-child relationship might be a good sample.
Also as you're not an expert as you said, think off something you can handle confidently.
It usually depends on the language you are hiring for. For example, when I went and gave an interview for PHP, I was asked to write a blog script, using custom MVC framework, whereas when I interviewed for an opening as a JS dev, I was asked to code a certain plugin in jQuery. Its more dependent on you are hiring the guy for ultimately. You dont want to ask someone to write you a music recommendation engine and then have him work on a payments gateway processor.

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!!!!

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

Categories