Starting late with coding

Opening and closing braces on new lines was part of VB code standards.

Several of those coding standards (which Mike, Scott and I defined) live on in XenForo. Here's an example:
PHP:
/**
 * Gets a news feed with the specified conditions.
 *
 * @param array $conditions
 * @param integer $fetchOlderThanId If > 0, only fetches items with a lower ID than this
 * @param array|null $viewingUser
 *
 * @return array
 */
public function getNewsFeed(array $conditions = array(), $fetchOlderThanId = 0, array $viewingUser = null)
{
	$this->standardizeViewingUserReference($viewingUser);

	if ($fetchOlderThanId)
	{
		$conditions['news_feed_id'] = array('<', $fetchOlderThanId);
	}

	$newsFeed = $this->getNewsFeedItems($conditions, $viewingUser['user_id']);

	$newsFeed = $this->fillOutNewsFeedItems($newsFeed, $viewingUser);
	$this->_cacheHandlersForNewsFeed($newsFeed);

	return array(
		'newsFeed' => $newsFeed,
		'newsFeedHandlers' => $this->_handlerCache,
		'oldestItemId' => $this->getOldestNewsFeedIdFromArray($newsFeed),
		'feedEnds' => (sizeof($newsFeed) == 0) // permissions make this hard to calculate
	);
}
 
Nothing beats experience.

Talk to individuals who regularly program in your language of choice, as they can probably point you to some useful books and other resources. Not all books and sites are created equal. Work through the examples and exercises until you master them, but make sure you actually know what the code is doing at the same time. If you don't, go back and read. Too often I've seen individuals try to learn C, for instance, and while they can follow instructions and complete most of the exercises, they don't have a clue what the code is actually doing. This just leads to bad habits down the road that are hard to break.

Once you've got the examples and exercises under your belt, take a look at some projects developed in your language of choice. This will give you an idea of how some things are done in a real world scenario. Now, dive in and start coding. There will be a lot of trial and error with all the above, which is a good thing. It'll help you learn the ins and outs of the language, common pitfalls, etc.

Personally, I taught myself the programming languages I know by lots of reading, working through exercises, a lot of trial and error, asking tons of questions, and by contributing to open source projects I was interested in. The latter is probably the most rewarding, as not only are you contributing to something, but you'll most likely get a lot of invaluable feedback from the project's developers.
 
Several of those coding standards (which Mike, Scott and I defined) live on in XenForo. Here's an example:
PHP:
<?php
include("the code from Kier's post");
?>
Great still opening braces on new lines, that's much more legible.
/me clicks "Like"
 
Tosh.

Depends on the college and teacher, sounds like you had a expectationally poor combination.

Depends on people's learning styles. Everything I know was picked up from trial and error and having a huge interest in coding. No amount of college or similar training could have brought me to where I am now.
 
Create something that you can actually use. Start with Python or Ruby (they are a lot of fun / don't have to be compiled).
 
My top pick for fellow learners, being to cut out the nonsense books which are mostly inaccurate, would be to purchase the following as a starter:
Very excellent to begin at the basics and advance your way through, and by the end you develop a very simple social networking site. The publishers website has a posted repository of the few misspellings, inaccuracies, so you have zero issue working your way through the book with everything working as supposed. I am currently about to begin the further advancement of php, mysql, javascript and ajax books singularly, each being highly recommended one's within their topics.
 
XF has both. :D

Yes, I know, I just prefer using all lowercase and underscores.

For example, if I wrote Kier's code, this is what it would look like:

PHP:
public function get_news_feed ( array $conditions = array ( ), $fetcholderthanid = 0, array $viewinguser = NULL )
{
    $this->standardize_viewing_user_reference ( $viewinguser );

    if ( $fetcholderthanid )
    {
        $conditions['news_feed_id'] = array ( '<', $fetcholderthanid );
    }

    $newsfeed = $this->get_news_feed_items ( $conditions, $viewinguser['user_id'] );

    $newsfeed = $this->fill_out_news_feed_items ( $newsfeed, $viewinguser );
    $this->_cache_handlers_for_news_feed ( $newsfeed );

    return array (
        'newsfeed'            => $newsfeed,
        'newsfeedhandlers'    => $this->_handler_cache,
        'oldestitemid'        => $this->get_oldest_news_feed_id_from_array ( $newsfeed ),
        'feedends'            => ( sizeof ( $newsfeed ) == 0 ) // permissions make this hard to calculate
    );
}

I have weird standards, I know (especially the spaces... I dunno, they just help me read it better). :p
 
Ha, the spaces bug me when I read it. Guess I'm glad we have flexibility in writing PHP to write to our preference. ;)
 
I started with writing Assembly for the Commodore 64, and then the Amiga. :) I sent a few programs to Ahoy! magazine.

Tried C, Fortran, Basic, Pascal, but never liked them. Assembly gave you complete control. :eek:

Ah... the good ol days! Yup. right there with ya, Lawrence. I actually did a BBS in assembly for the C64. Fun stuff, huh?!
 
Top Bottom