Author Topic: I'm way too distractable!  (Read 5289 times)

0 Members and 1 Guest are viewing this topic.

Offline Sophia

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
I'm way too distractable!
« on: July 06, 2010, 01:00:10 am »
I swear I have adhd or something!

So I am trying to learn python by making a text adventure game, and I got a few things going, I have a prologue and a main routine that runs the prologue and a way to hold all the variables and transfer them between modules (but not yet to save them although I am sort of working on that but I got distracted...).

Then I got fed up of how ugly the prologue was when I was trying to make flowcharts to guide making chapter1. So I went off exploring to find out how to use ncurses. Which is what I am doing now lol.

I'm never actually gonna get anything done am I, I'm just going to be all "arrgggh that needs changing" and maybe by the end of it I will have the best prologue ever, but that's it lol. (Looks much prettier with curses...).

Offline BkS

  • BkS Media Founder
  • Hero Member
  • *****
  • Posts: 1691
  • Karma: 49
  • Gender: Male
  • sudo service reality-check start
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #1 on: July 06, 2010, 02:51:48 am »
epic.
If you try to look through Windows, you can see what the person is doing.
If you try to look through a Penguin, it WILL bite you.

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1436
  • Karma: 10023
  • Gender: Male
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #2 on: July 06, 2010, 03:10:44 am »
You will find (!) as you learn bits, if you encapsulate them in classes you'll be able to forget the details .. this makes like "much" easier.

But just to rock the boat again, I have to say I only use python for services / batch scripts, not for anything interactive. (too slow) If you want a nice GUI programming language with a nice built-in IDE, IMHO the best thing available on Linux is Gambas. (VB for Linux)

Having said that (!) I do all my UI coding in Javascript now using ExtJs.
(Take a look at; http://www.sencha.com/deploy/dev/examples/ )

:)

Offline Sophia

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #3 on: July 06, 2010, 10:28:15 am »
Hmmm,
Now you are suggesting more things right after I said how distractible I was :o

I wonder if this is the kind of thing where it is better to focus on one thing at a time or where its ok to go off a wandering in all directions to look at stuff that seems interesting? With natural languages I was always told that you have to only learn one at a time, to be honest I am a little sceptical of that advice, I think its perfectly feasible to learn two, and if you have time, even three at a time (but most people will not have time for three languages they don't know unless they are like a professional linguist or something), you don't really get confused between them so much (OK I admit sometimes my Russian sentences have German/Welsh and even rarely French words in them, but I am not trying to learn German, Welsh or French so the confusion is not down to that - and you pick up on it immediately).

One thing that is certainly true with natural languages is that the most important thing to do is actually use them, even if like me you don't actually know any native speakers and just torment your poor family by talking to them in weird foreign tongues (they can't correct you of course like a native could...). I would presume it is the same also with programming languages - but that is a very hard part for me I think, thinking up things to actually do... I'm way too complacent in that respect (why do you think I used nothing but windows till I was 24!)

Oooh, but I emailed the guy who runs the compsci department at my uni and he said it's totally ok for me to sit in on the first year's programming lessons if I want.

*Goes to investigate how this classes thing works*
« Last Edit: July 06, 2010, 10:30:10 am by Sophia »

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1436
  • Karma: 10023
  • Gender: Male
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #4 on: July 06, 2010, 06:38:52 pm »
Difference is , computer languages are all very similar;

Quote
BASIC: for x = 1 to 10 .. next
C: for(x=1;x<=10;x++) {}
Javascript: for(x=1;x<=10;x++) {}
PHP: for($i=1;$i<=10;$i++) {}
Python: for i in xrange(1,11):

You can get caught out on subtle syntax differences, but they really are all similar ... it's just speed and method of execution, robustness, access to system resources, built-in constructs etc that differ. It's not like we still work in COBOL (or DIBOL, or FORTRAN ..)  ;-)

Note specifically how similar C, Javascript and PHP are .. learning one of those pretty much gives you instant access to the other two in terms of syntax, at a superficial level at least. The only real difference is that C runs faster and at a lower level and is missing lots of the nice data types like strings and lists.

Offline Sophia

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #5 on: July 06, 2010, 09:54:24 pm »
So you're advice is try and learn them all at once? (because they are all similar so it what you get from one helps with others) or definitely don't try and learn them all at once (because they are all similar and you will mix them up)?

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1436
  • Karma: 10023
  • Gender: Male
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #6 on: July 07, 2010, 09:04:19 am »
My advice is "learn to code" and don't worry too much about the "what in".
95% of coding is problem solving, 5% is syntax and language.

Personally I'd always start with 'C'.
Just for kick-off, this is what most other languages are written in, indeed it's what 'C' is written in.
Once you've "got" 'C' , you've pretty much got most of everything else. (/everything else is easier .. :) )

(It's a self-compiling compiler .. bit like GNU being a recursive acronym .. ;) )

Offline shtromm

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 2
  • I've just joined!
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #7 on: July 07, 2010, 10:20:02 am »
Ok - I earned the most time of professional life my money as programmer. So my 2p:

1) It is important to learn a strict and clear style. I do not see C or Java here as the best languages, but Pascal or ADA, even both are not very common, but both are forcing a clear and consistent style.

2) Read some the basic texts regarding software engineering - especially, "Algorithms + Data Structures = Programs" by Niclas Wirth, Prof. emeritus, ETH Zuerich

3) Burn your fingers on your own: Be not afraid of making mistakes: We all do and it is normal that a beginner does so.

4) Test your program extensively! You will see the nonsense you made (see 3 above)

5) Write documentation: Documenting is important for the quality of your software. If you need to explain in writing the stuff you made, you will come across a lot of the errors you made.

6) Adopt a good coding style: May have a look in Steve McConnell, Code Complete (even it comes from M$)

Offline shtromm

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 2
  • I've just joined!
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #8 on: July 07, 2010, 10:28:43 am »
Difference is , computer languages are all very similar;

Quote
BASIC: for x = 1 to 10 .. next
C: for(x=1;x<=10;x++) {}
Javascript: for(x=1;x<=10;x++) {}
PHP: for($i=1;$i<=10;$i++) {}
Python: for i in xrange(1,11):

You can get caught out on subtle syntax differences, but they really are all similar ... it's just speed and method of execution, robustness, access to system resources, built-in constructs etc that differ. It's not like we still work in COBOL (or DIBOL, or FORTRAN ..)  ;-)

Not really; lets take a bit of C:

Code: [Select]
char szString [10];
char *pChar;
int    *pInt;

/* something code */

pChar = pInt;

szString [12] = 'A';

In C this code will compile in C without any difficulties, leading to disaster. In C++ you would need to cast the pointer:

Code: [Select]
pChar = (char *) pInt

... again leading to disaster.

---

Doing the same in Pascal (my old love):

Code: [Select]
szString : string [10];
pChar : ^char;
pInt : ^int;

{ some code }

pChar := pInt;
szString [12] := 'A';

Would just not compile! There is no way to force a Pascal (or ADA) compiler to do such nonsense.
« Last Edit: July 07, 2010, 10:31:11 am by shtromm »

Offline Sophia

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #9 on: July 07, 2010, 01:53:48 pm »


You can get caught out on subtle syntax differences, but they really are all similar ... it's just speed and method of execution, robustness, access to system resources, built-in constructs etc that differ. It's not like we still work in COBOL (or DIBOL, or FORTRAN ..)  ;-)
My dad still uses FORTRAN he was complaining to me his compiler has no concept of random number generation. I was very confused by that. Surely that cannot be? That's my favourite thing!

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1436
  • Karma: 10023
  • Gender: Male
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #10 on: July 07, 2010, 05:42:38 pm »
Quote
Not really; lets take a bit of C:

char szString [10];
char *pChar;
int    *pInt;

pChar = pInt;
szString [12] = 'A';

pChar = (char *) pInt

... again leading to disaster.


Ok, you can break anything if you try hard enough, the fact you 'can' drive a car into a brick wall doesn't make it inherently unsafe ...

First;

Code: [Select]
pChar = pInt;

This will compile (as you would want it to) but it *will* tell you that what you've done might cause you a problem. Specifically you'll get an "assignment from incompatible pointer type" warning .. it might be that this is actually what you want to do, it's certainly something I've used in the past, naturally if you wanted to do this you would type the conversion with pChar = (char*)pInt - off the top of my head, quite handy for converting an integer into bytes, here's a runnable segment, compile with "gcc -std=c99 mp.c -o mp";

Code: [Select]
/* mp.c */
#include "stdio.h"
#include "stdlib.h"
main()
{
        char *pChar;
        int *pInt;

        pChar = pInt;
        *pInt=10;

        for(char *p=pChar;p<(pChar+sizeof(pInt));p++)
                printf("%02x ",*p);
        printf("\n");
}

As I'm guessing you know, no 'C' programmer would do this;

Quote
szString [12] = 'A';


Assuming this is the function required, you'd always wrap it with something like;

Code: [Select]
int setChar(char *memory,int size,int index,char byte)
{
    if(index>=size) return 0;
    *(memory+index)=byte;
    return 1;
}

setChar(szString,sizeof(szString),12,'A');

Which would be safe ... as for C++, nobody in their right mind (fx: don's fireproof suit) uses C++ through choice. See this link; http://artlung.com/smorgasborg/Invention_of_Cplusplus.shtml. Now I know this is touted as a "joke", but I think there's more than a sliver of truth in it, which is why it's been reproduced so many times .. (!)

Firstly I like Pascal, it was the first language I was taught at Uni, however it's doesn't typically have library support for writing high level applications and it's not flexible enough when it comes to system applications. The only half-way decent implementations were Borland Pascal and Borland Delphi, (or Kylix on Linux) but eventually Borland sort of collapsed and they do all-sorts now - Delphi never really worked for them and Kylix was a spectacular failure.

Quote
Code: [Select]
szString : string [10];
pChar : ^char;
pInt : ^int;

pChar := pInt;
szString [12] := 'A';

Would just not compile! There is no way to force a Pascal (or ADA) compiler to do such nonsense.


Erm, Pascal has typecasting just the same as 'C' has typecasting, it's really easy to produce the same sort of problem in Pascal and as for Delphi, it's potential for mis-casting is epic! See how badly this breaks for you ...

Code: [Select]
program demo;

type
        pChar = ^Char;

var
        S1 : String = '123';
        ch : pChar;

begin
        Writeln('Hello World');
        ch := @S1;
        Writeln(ch);
end.

At the end of the day, all languages (generally, I think Pascal is an exception) are written in 'C', as is Linux, and until you learn 'C' you'll never 'really' understand how all the other languages work .. personally I got a lot from writing an interpreter in Pascal, but didn't quite get everything until I ported it into 'C'.

Incidentally, were you aware that Linus did actually port the Linux kernel to C++ and released a version at one point .. from memory it was back in the early / mid 90's .. but it was very short lived. More recently Linus has been quoted as saying;

Quote
C++ is a horrible language. It's made more horrible by the fact that a lot
of substandard programmers use it, to the point where it's much much
easier to generate total and utter crap with it. Quite frankly, even if
the choice of C were to do *nothing* but keep the C++ programmers out,
that in itself would be a huge reason to use C.


Also;

Quote
I've come to the conclusion that any programmer that would prefer the project to be
in C++ over C is likely a programmer that I really *would* prefer to piss
off, so that he doesn't come and screw up any project I'm involved with.


My personal preferences are 'C' for anything needing performance, 'Python' for system services / scripting, PHP for web / JSON applications, and Javascript (obviously) for client side browser UI work. (and Gambas for native/UI work) I don't tend to use anything else apart from the occasional Bash script. I'd use Pascal, if I had to (never have) , C++ if I was desperate, and Perl the day Hell freezes over.

When I get some time I will be taking a Peek at "go";
http://golang.org/

Offline shtromm

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 2
  • I've just joined!
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #11 on: July 08, 2010, 06:27:41 am »
Firstly I like Pascal, it was the first language I was taught at Uni, however it's doesn't typically have library support for writing high level applications and it's not flexible enough when it comes to system applications. The only half-way decent implementations were Borland Pascal and Borland Delphi, (or Kylix on Linux) but eventually Borland sort of collapsed and they do all-sorts now - Delphi never really worked for them and Kylix was a spectacular failure.

I wrote in Std./ISO-/DIN-Pascal in the early 1990s software for statical modeling of support masts for the railway and power supply - it was perfect for the mathematical stuff and I enjoyed it, but a text-file-in-text-file-out is not what is asked today. There were some implementations of the conio for Pascal, to create at least some menus in text mode, but far below of today's standards of usability.

I still would promote Pascal as a first learning language, for which it was originally designed.

Erm, Pascal has typecasting just the same as 'C' has typecasting, it's really easy to produce the same sort of problem in Pascal and as for Delphi, it's potential for mis-casting is epic! See how badly this breaks for you ...

Not really C has some, from a structural programming concept point of view, "ugliness", as the void-pointer and the union, often misused for quick-and-dirty type conversations (I think it was N. Wirth how doubt that C is really a high language). But those "ugliness" are of great benefit for low level programming, as for the Kernel, or for high performance.

At the end of the day, all languages (generally, I think Pascal is an exception) are written in 'C', as is Linux, and until you learn 'C' you'll never 'really' understand how all the other languages work .. personally I got a lot from writing an interpreter in Pascal, but didn't quite get everything until I ported it into 'C'.

Incidentally, were you aware that Linus did actually port the Linux kernel to C++ and released a version at one point .. from memory it was back in the early / mid 90's .. but it was very short lived. More recently Linus has been quoted as saying;

Quote
C++ is a horrible language. It's made more horrible by the fact that a lot
of substandard programmers use it, to the point where it's much much
easier to generate total and utter crap with it. Quite frankly, even if
the choice of C were to do *nothing* but keep the C++ programmers out,
that in itself would be a huge reason to use C.

C++ is an ugly language and gets from version to version even more ugly by implementing different and antagonistic concepts into the same language - unfortunately it is also the most used language ("People eat more shit - millions of flies can't be wrong" ;-) )

I started a while ago to teach myself ADA and I found the object-orientated concepts much clearer and easier to implement than with C++. But ADA is only a niche language, but does deserve IMHO a much more prominent place.
« Last Edit: July 08, 2010, 03:38:03 pm by shtromm »

Offline kirrus

  • Full Member
  • ***
  • Posts: 133
  • Karma: 2
  • Sysadmin / Linux Tech Support
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #12 on: July 08, 2010, 08:59:54 pm »
PHP is good in experienced hands, but can be a nightmare in bad programmer's hands.

One of the programs that gives us the most headaches here is.. wordpress. Badly optimized, and is a right pig to scale to high-load websites.

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1436
  • Karma: 10023
  • Gender: Male
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #13 on: July 09, 2010, 02:48:19 am »
I do consultancy .. ;)

linux.co.uk is configured for 1/8th of cloud capacity and can do ~ 70 pages / sec (using "ab") , and of course it's Wordpress .. and it's on a shared platform .. :)
(I see no reason why within the context of current hardware scalability shouldn't be linear, so that would be  over 500 pages / sec .. which isn't bad!)

Offline kirrus

  • Full Member
  • ***
  • Posts: 133
  • Karma: 2
  • Sysadmin / Linux Tech Support
    • View Profile
    • Awards
Re: I'm way too distractable!
« Reply #14 on: July 09, 2010, 03:15:16 pm »
The problem is, our hardware is expensive. For a fully managed server, list price for our most basic is around £380 per month, though it's rare to charge list.

So, most people can't afford hardware. So, they instead tell us to get the most performance out of their single (admittedly, quad-core) machines. One server we've got dies horrible the second you take off either wp-supercache, or eaccelerator, with their standard constant traffic load.

Another set of servers spends most of the time mostly idle, and every now and then goes bat-shit insanely busy. Though that system, eaccelerator is too much of a pain. (It randomly causes seg-faults in apache, from time to time.) That was solved by throwing hardware at the problem. 3 web servers x 2 quad-core CPUs in each.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal