Find the answer to your Linux question:
Results 1 to 5 of 5
Hey everyone, So since summer has begun and i have plenty of time on my hands (no studying woohoo! Just a full-time research position!) I have been able to finally ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    96

    Questions from someone getting into scripting webpages and servers.


    Hey everyone,

    So since summer has begun and i have plenty of time on my hands (no studying woohoo! Just a full-time research position!) I have been able to finally take up learning web design and development like i have been wanting. If you seen my other threads you might have noticed i have been trouble with getting a home server running (with a dynamically changing IP). Although I am still having trouble with the server i figured i might as well not waste time with hosting when i don't know how to even make the website!

    So i took up learning (X)HTML, then after i got the basics of that down i moved on the CSS, and now i have the basics of CSS under my belt (looking forward to learning more about page layouts soon though), i am now studying javascript. In the tutorials i have been reading/watching they mention an extremely useful library called JQuery. Although JQuery seems to make javascripting sooooooo much easier, i can't shake the feeling that i am cheating. I really want to know how to do Javascript, not just use JQuery. It just feels like JQuery was what Javascript should have been (like using CSS tags instead of having to get each element by a specific attribute then sorting through that element to find sub elements, etc).

    So do you think it's best if i just try to keep avoiding Jquery when i can? Or is it inevitable that i will end up using it for my website?

    Second question: What is a good order of learning

    My original plan for this summer was the follows:

    1. (X)HTML
    2. CSS
    3. JavaScript
    4. PHP
    5. MySQL

    Then move onto things such as AJAX, Flash, Python and Perl. Do you think this is good in terms of someone who wants to build a website and server by themselves?

    Third question: What are you opinions on PHP vs Python Vs Perl? I hear a lot of talk about Python replacing PHP and Perl completely for server side scripting but i cant help but feel the need to learn PHP before either one as it was designed specifically for server side web development.

    Thanks for the info guys!
    Last edited by Silman; 06-26-2012 at 06:51 AM.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    jQuery is amazing. Use it. Everyone else does. Seriously. Every company I have worked at has used jQuery for its frontend JS. Vanilla JavaScript is difficult to use for DOM manipulation, is hard to get to work on all browsers, and does not have many of the convenient functions that jQuery does.

    As for your other questions, there's no great answer for this. HTML and CSS are probably good to learn first, since everything else kind of relies on them. Databases are pretty much an entirely separate subject, and MySQL is a fine example of one.

    On the subject of serverside languages, I don't like PHP. I used to like Perl, but for the past few years, I've been enamoured of Ruby and Ruby on Rails. No matter what language you use, I highly recommend learning an MVC framework (such as Ruby on Rails for Ruby, or Django for Python). Ruby, Perl, and Python have the advantage of teaching you a generally useful scripting language, as opposed to PHP, which is only used for web development.

    I will note that to make the best use of dynamic web servers, you are going to be interacting with databases, so it might be worthwhile to learn some DB basics before trying your hand at the serverside scripting.

  3. #3
    Just Joined!
    Join Date
    May 2012
    Posts
    96
    Thanks for information! I want to continue learning Javascript but i see now that it really speeds things up. I would still feel bad if i learned only JQuery and not real javascript.

    I was wondering what exactly a MVC framework is, and what does it do? I am partial to python because i already know a lot of the language, but am completely willing to learn others.

    noting your last comment, do you suggest i try to learn MySQL (or similar) before something like PHP, the tutorials i have seen around usually teach PHP and MySQL hand in hand.

  4. #4
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    MVC stands for Model-View-Controller. It's basically a framework philosophy that has you make clear separations between the different parts of your site.

    In PHP (which is not MVC), you mix your website logic with the HTML. For example, PHP might look like this:
    Code:
    <?php
    $username = get_kerberos_username();
    $name = get_name_for_user($username);
    $jobs = get_jobs_for_user($username);
    ?>
    
    <h2>Welcome <?= $name ?>!</h2>
    
    <h3>Jobs</h3>
    
    <ul>
    <?php
    for ($jobs as $job) {
    ?>
    
    <li><?= get_name_for_job($job) ?></li>
    
    <?php
    }
    ?>
    
    </ul>
    
    <h3>New Jobs</h3>
    
    <ul>
    
    <?php
    $new_jobs = lookup_new_jobs_for_user($username);
    
    foreach ($new_jobs as $job) {
    ?>
    
    <li><?= get_name_for_job($job) ?></li>
    
    <?php
    }
    ?>
    
    </ul>
    You are intermixing your business logic, your DB calls, and your HTML. In a simple example, this may work, but it gets harder and harder to maintain and tell what is doing what.

    In an MVC framework, your DB calls (model), the logic of your page (controller), and your HTML (view) are all separate. For example, in Ruby on Rails:
    Code:
    # in your model file
    
    class User
      has_many :job
    end
    
    class Job
    
    def name
      # Implementation
    end
    
    end
    Code:
    # in your controller file
    
    def index
      username = get_kerberos_user()
      @user = get_user_for_username(username)
      @new_jobs = lookup_new_jobs_for_user(username)
    end
    Code:
    # in your view file
    
    <h2>Welcome <%= @user.name %>!</h2>
    
    <h3>Jobs</h3>
    
    <ul>
    <% @user.jobs.each do |job| -%>
    <li><%= job.name %></li>
    <% end -%>
    </ul>
    
    <h3>New Jobs</h3>
    
    <ul>
    <% @new_jobs.each do |job| -%>
    <li><%= job.name %></li>
    <% end -%>
    </ul>

    Here, you have a clear separation between who is doing what. Only the model file is directly contacting the database and describing the database schema, only the controller is doing any calculation or logic, and only the view is taking what the controller produced and making HTML with it.

    On super small pages and contrived examples like this, it can be a bit tough to see the value of this, but as someone who has maintained both styles, trust me that it is .


    Oh, and as for learning databases alongside serverside languages, you can maybe learn the very basics simultaneously. Your basic CRUD operations, for example. However, databases are a pretty complex topic, so you will eventually want to study them independently.

  5. #5
    Just Joined!
    Join Date
    May 2012
    Posts
    96
    Thanks for the information again! That does seem pretty nifty as it makes the source code for HTML a lot clearer. I will check out PHP but as i keep reading about it i feel like it's something i am only going to dabble into for the sake of knowing where server side scripting came from.

    If anyone has any other information on the matter to any of my three questions please feel free to give your two cents, i am just beginning and can use all the information i can get!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •