GO37H3's n00b to 1337 programming/comp thread

  • Thread starter Thread starter G037H3
  • Start date Start date
  • Tags Tags
    Thread
AI Thread Summary
The discussion emphasizes the importance of learning programming through a focus on metaskills rather than specific languages, with Python being favored for its forgiving syntax. The participant expresses a desire to understand general concepts applicable to various fields, including engineering and computer science. They seek foundational knowledge in logic and programming, questioning the relevance of reading works by George Boole and other foundational texts. Suggestions are made for resources like "Structure and Interpretation of Computer Programming" and practical frameworks like Django for future work opportunities. The overarching goal is to become employable through programming while maintaining a flexible schedule for other studies.
G037H3
Messages
280
Reaction score
2
A quick note: when learning anything, I wish very strongly to focus on things that have cross-applications. I have little interest in focusing on learning specific skills, so when I state an interest in programming or closely related subjects, I mean that I wish to learn the metaskills associated with it. Logical, clear, precise programming that can be used even for supercomputers, not a language specific skill that teaches me nothing about computing in general. I don't see anything as a stand-alone field, so it is very important to me to learn very abstract/general aspects that I can use in the future when messing with supercomputers, or for other subjects within the "Engineering" label, such as architecture, drafting, materials science, etc.

So, all-encompassing and general concepts>specific things, k?

As I stated in the other thread (which went off-subject), I believe that Python is the best first language (for me at least). Because I have a tendency to focus on the global picture, a language that doesn't punish me for little mistakes is best. I know that C++ is 'stronger', whatever. It also has a $*%@load of rules and exceptions that I would rather avoid learning for now.

First couple of questions: I noticed a book by Boole at the library. Would that help with programming at all, or would it be best to wait a bit for that? A related question, what prerequisites are really useful? I know that logic helps, but should I seriously jump into logic right away? Anything else?

I am looking for a dull retail job right now. As I wish to make more $ than that, and to have flexible hours so that I may focus on other things (mathematics and German, for instance), I see programming as a way to ensure that I don't become homeless, as well as being a primary job until I begin consulting, or whatever else that my educational growth will allow. Right now I live on roughly $10K a year, so even a $20K year job/freelance work would be great for a year or two. :D So I figure that to develop the habit of working on programming and super closely related stuff, that I should devote a specific amount of time per day to it. For now, I think that 3 hours a day should be satisfactory, and that figure could easily be maintained even in the case that I get a job.

I personally feel that I'm almost unemployable, so my goal is to become employable through programming ASAP. ^_^ It's a contingency plan, so I can have control over my own life and ensure that I go to uni, etc.
 
Technology news on Phys.org
I learned JAVA as my first programming language (only because I took AP Comp Sci) and when I look at some Python (not for learning, but I've seen my fair share of Python) I get confused because I'm so used to JAVA's complexity haha.

Oh and for you G037H3, If you haven't already gone to this site, http://www.codingbat.com" , it has a Python Section and a JAVA section for doing simple to complex problems and since you're learning Python I guess it can help :D.
 
Last edited by a moderator:
G037H3 said:
First couple of questions: I noticed a book by Boole at the library. Would that help with programming at all, or would it be best to wait a bit for that? A related question, what prerequisites are really useful? I know that logic helps, but should I seriously jump into logic right away? Anything else?

Like... George Boole? It seems difficult to imagine a situation where reading a book would be a bad thing. I do not think reading foundational texts on logic would be very directly applicable to the skills you need in computer programming, however, I think it would likely be personally enriching for other reasons.

If you want something sort of foundational to read which is related to computer science, I would highly suggest http://mitpress.mit.edu/sicp/. This is a book by MIT press which is free to download and read online. It teaches a completely useless* programming language called LISP, but the language they use is not the important part, the important part is how they teach you how to think about programming.

You also might again if you're interested in the foundations of computer science want to try to read up on automata theory (finite automata, turing machines, etc). This will not be as useful when doing introductory programming but will help a lot with giving you the basis to think about the issues you will encounter if you start working with computer science at a higher level. (Unfortunately I don't have a specific book recommendation in this area.)

Also as long as you're interested in foundational logic texts, Russell and Whitehead's Principia Mathematica is actually surprisingly readable if you skip the proofs... again not very applicable to programming specifically.

* IN SUCH ENDEAVORS HAVE I WASTED MY YOUTH

Right now I live on roughly $10K a year, so even a $20K year job/freelance work would be great for a year or two. :D So I figure that to develop the habit of working on programming and super closely related stuff, that I should devote a specific amount of time per day to it. For now, I think that 3 hours a day should be satisfactory, and that figure could easily be maintained even in the case that I get a job.

If you are looking for small-dollar contracting work and you're already learning python, I suggest once you have some basics out of the way you start trying to learn a web framework such as Django or Pylons. That's where the work is likely to be if you're working at that level.

Also really I think you are probably more likely to be able to get into contract work after you've had at least some entry-level actual employment in the field. The hard part of contracting is not actually the programming but rather your relationship with the customer, and knowing what the customer needs isn't something you're going to learn from a book.
 
Are you on Windows? I found a video that can help you get started:


There appear to be a bunch of Python tutorials on youtube.
 
Last edited by a moderator:
MysticDude said:
I learned JAVA as my first programming language (only because I took AP Comp Sci) and when I look at some Python (not for learning, but I've seen my fair share of Python) I get confused because I'm so used to JAVA's complexity haha.

Oh and for you G037H3, If you haven't already gone to this site, http://www.codingbat.com" , it has a Python Section and a JAVA section for doing simple to complex problems and since you're learning Python I guess it can help :D.

I sincerely believe that Python is better as a first language, because the focus is on applications, not explaining syntax. It's self-evident.

Thanks for the site, I bookmarked it.

Like... George Boole? It seems difficult to imagine a situation where reading a book would be a bad thing. I do not think reading foundational texts on logic would be very directly applicable to the skills you need in computer programming, however, I think it would likely be personally enriching for other reasons.

If you want something sort of foundational to read which is related to computer science, I would highly suggest Structure and Interpretation of Computer Programming. This is a book by MIT press which is free to download and read online. It teaches a completely useless* programming language called LISP, but the language they use is not the important part, the important part is how they teach you how to think about programming.

You also might again if you're interested in the foundations of computer science want to try to read up on automata theory (finite automata, turing machines, etc). This will not be as useful when doing introductory programming but will help a lot with giving you the basis to think about the issues you will encounter if you start working with computer science at a higher level. (Unfortunately I don't have a specific book recommendation in this area.)

Also as long as you're interested in foundational logic texts, Russell and Whitehead's Principia Mathematica is actually surprisingly readable if you skip the proofs... again not very applicable to programming specifically.

* IN SUCH ENDEAVORS HAVE I WASTED MY YOUTH

Yes, George Boole. The book was one of his works, and it was printed ~70 years ago. I think that logic would help for CS/programming...it would provide more of a direct problem solving method than arriving at a fully-formed solution. In short, logic allows for the decomposition of problems. :3 But if I am to fully appreciate his work, I assume that I would require a more foundational logic text to begin with. :/

I know about SICP (people on /g/ talk about it every once in a while), but I believe that I should focus on Python+CS, as dispersal of interest/focus is a very real possibility, because of my wide-ranging interests and talents.

Yes, I think that a study of CS would be very useful as a paired study with Python+programming, focusing on architecture and similar subjects. >.< I'm not sure where I should start with that, either.
"[URL
Maybe this?[/URL]

I don't want to study something, and then come back to it later. I want to do a detailed study the first time, and understand it in-depth, much like I am doing with Euclid's Elements.

If you are looking for small-dollar contracting work and you're already learning python, I suggest once you have some basics out of the way you start trying to learn a web framework such as Django or Pylons. That's where the work is likely to be if you're working at that level.

I don't know what those are. ;o

Also really I think you are probably more likely to be able to get into contract work after you've had at least some entry-level actual employment in the field. The hard part of contracting is not actually the programming but rather your relationship with the customer, and knowing what the customer needs isn't something you're going to learn from a book.

I'm okay with entry-level or whatever, as long as working conditions are reasonable. But I'd rather be paid $10 an hour to do general stuff and learn tons about CS and programming than be paid $25 to do specific work that only teaches me about that specific language/system/program/whatever.

Are you on Windows?

Win Vista Ultimate 64

I figured out the install (and just installed it); I had to discern whether to install the x86 or x86-64, something about bits I guess. I'll learn that later.

There appear to be a bunch of Python tutorials on youtube.

I will definitely take a look, though I do believe I've found http://www.openbookproject.net/thinkCSpy/#"
 
Last edited by a moderator:
G037H3 said:
I sincerely believe that Python is better as a first language, because the focus is on applications, not explaining syntax. It's self-evident.
Well when I was put into AP Comp Sci it is not like we had a choice. Plus with the Android OS being built on Java, I could do something with it as I am always expanding my knowledge with Java.

Good Luck with your life :D
 
Here you go:

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/index.htm"
 
Last edited by a moderator:
fluxions said:
Here you go:

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/index.htm"

Thanks.

I don't know which IDE to use. :(
 
Last edited by a moderator:
G037H3 said:
I have little interest in focusing on learning specific skills, so when I state an interest in programming or closely related subjects, I mean that I wish to learn the metaskills associated with it.

Ah, yes. You want to learn the metaskills of digging without touching a shovel. Unfortunately there is no easy way. You have to get your hands dirty.

In my opinion the best languages to train your metaskills are usually those that have no much general use (Lisp, Prolog, Forth).

Otherwise the languages are pretty the same. What differs is they all use different libraries to help the development of software. So, if you want to use a language for practical purposes you need to get specific.
 
  • #10
G037H3 said:
I don't know which IDE to use. :(

You don't need an IDE to get started. Just use a plain text editor and the command line. That will force you to become familiar with what files you're using and where they are, and exactly what steps are involved in the compilation/linking process.

When your programs get big enough that an IDE actually becomes useful, that's the time to learn how to use one.
 
  • #11
G037H3 said:
Thanks.

I don't know which IDE to use. :(

I use IDLE, which comes with the Python distribution. It should work just fine for you while you are still learning the basics.
 
  • #12
Upisoft said:
Ah, yes. You want to learn the metaskills of digging without touching a shovel. Unfortunately there is no easy way. You have to get your hands dirty.

In my opinion the best languages to train your metaskills are usually those that have no much general use (Lisp, Prolog, Forth).

Otherwise the languages are pretty the same. What differs is they all use different libraries to help the development of software. So, if you want to use a language for practical purposes you need to get specific.

I mean that I want to focus on algorithms+data structures.
You don't need an IDE to get started. Just use a plain text editor and the command line. That will force you to become familiar with what files you're using and where they are, and exactly what steps are involved in the compilation/linking process.

When your programs get big enough that an IDE actually becomes useful, that's the time to learn how to use one.

I know I don't *need* one. But I want one. Preferably with a black background and pretty colors. :O
I use IDLE, which comes with the Python distribution. It should work just fine for you while you are still learning the basics.

I'll see what other people think of it as well. >.<
 
  • #13
G037H3 said:
I mean that I want to focus on algorithms+data structures.
<

The standard 'introductory' book on algorithms is https://www.amazon.com/dp/0262033844/?tag=pfamazon01-20. But attempting to read that book before having some basic programming experience and sufficient mathematical sophistication is futile. When you're ready, there is an OCW based on the book.


G037H3 said:
I'll see what other people think of it as well. >.< <

What does it matter what other people think? Try it, and see what you think.
 
Last edited by a moderator:
  • #14
G037H3;2960145 I have little interest in focusing on learning specific skills said:
Why waste time with metaskills when you can learn meta-metaskills?
 
  • #15
fluxions said:
The standard 'introductory' book on algorithms is https://www.amazon.com/dp/0262033844/?tag=pfamazon01-20. But attempting to read that book before having some basic programming experience and sufficient mathematical sophistication is futile. When you're ready, there is an OCW based on the book.




What does it matter what other people think? Try it, and see what you think.

Yeah, I know I have to go through calculus->discrete mathematics before I can do advanced CS Knuth-type stuff. I already said that I want a black background and colors. :/
 
Last edited by a moderator:
  • #16
fluxions said:
Why waste time with metaskills when you can learn meta-metaskills?

My approach is logical. I have a lot to accomplish in a short amount of time.
 
  • #17
G037H3 said:
I have a lot to accomplish in a short amount of time.

Then start programming and stop worrying about your IDE having pretty colors.
 
  • #18
fluxions said:
Then start programming and stop worrying about your IDE having pretty colors.

I figured it out -_-

But if you want to practice piano, it's not good to practice on a piano that's out of tune. :)
 
  • #19
G037H3 said:
I figured it out -_-

But if you want to practice piano, it's not good to practice on a piano that's out of tune. :)

Your piano is not out of tune. You just wanted red and green keys instead of black and white. :smile:
 
  • #20
Math Is Hard said:
You just wanted red and green keys instead of black and white. :smile:

And a Liberace-style outfit instead of jeans and a T-shirt. :-p
 
  • #21
Math Is Hard said:
Your piano is not out of tune. You just wanted red and green keys instead of black and white. :smile:

well if I'm playing in the dark, I'd like the keys to glow...
 
  • #22
If I have an IDE, for the IDE to check the syntax of what I'm writing, why would that necessitate changing the compiler? I was told that it would, but I don't see why. :/
 
  • #23
Get stuck in. Do some programming, start with the basics ("hello world") and work your way up. There are plenty of tutorials out there and they are what you need.

I personally use Visual Basic to do all my programming. It does the job nicely.

You seem to want an autocorrect facility in your text editor. As helpful as these can be, you will become dependent on it and it can hinder your learning as you will stop concentrating and just let it keep covering your mistakes. I recommend going straight in with a bare text editor (I use gedit - it is free, you can customise font and background colour - plus you can set it to various languages to help you with syntax etc).
 
  • #24
jarednjames said:
Get stuck in. Do some programming, start with the basics ("hello world") and work your way up. There are plenty of tutorials out there and they are what you need.

I personally use Visual Basic to do all my programming. It does the job nicely.

You seem to want an autocorrect facility in your text editor. As helpful as these can be, you will become dependent on it and it can hinder your learning as you will stop concentrating and just let it keep covering your mistakes. I recommend going straight in with a bare text editor (I use gedit - it is free, you can customise font and background colour - plus you can set it to various languages to help you with syntax etc).

I'm working through the first chapter today; I intend on posting what I've learned before I go to sleep tonight.

VB seems to be pretty heavily disparaged.

I don't *want* one, I want to understand why the statement in the last post I made is the case.
 
  • #25
G037H3 said:
VB seems to be pretty heavily disparaged.

I like it. It works well for me and my applications of it. It all depends what you are trying to do. I build apps for use within a Microsoft Windows environment with easy access to api's for Office products and various other windows components, it is exactly what I need.

You should choose your language based on requirements.
I don't *want* one, I want to understand why the statement in the last post I made is the case.

Was only letting you know what I use and how it may be useful for you. And also to point out the problems with having the computer autocorrect for you when attempting to learn.

If you really want to get stuck in and into paying work as quick as possible, keep it simple. Start with HTML and then work on PHP. Shouldn't take you long to get the basics (enough work and you'll have it in days), they are relatively easy to learn, especially HTML. Once you've done that, even with only the basics it is easy to get straight into website development. Do a few simple jobs, continue learning and start taking on the more complex oportunities.

I will say this, although I don't personally like java it is a very powerful language and would be one of the best to learn.
 
  • #26
I think G037H3's heart is set on learning Python, so let's focus on that for now. I don't have experience with it, but I have heard many people say that it is quite suitable for a first language.
 
  • #27
Math Is Hard said:
I think G037H3's heart is set on learning Python, so let's focus on that for now. I don't have experience with it, but I have heard many people say that it is quite suitable for a first language.

correct :o
 
  • #28
I was referring more to the desire to earn a quick buck. Web design is one of the best ways to go about this in my experience.
I will limit all future input to python only. Although the op should specify this limitation to the discussion as so far much of it hasnt met that requirement.
 
  • #29
Day 1 of Python:

A high-level language (Python is an example) most be processed into low-level language before it can run. A low-level language (machine or assembly languages) is the only type of language that a computer can execute programs in. Therefore, a program written in a high-level language must be processed into a low-level language before it can run. High-level languages are portable, meaning that programs written in them can run on other computers with zero to few modifications. Low-level languages are specialized ('close to the metal', 'close to the hardware') and must be rewritten for different kinds of computers.

Two kinds of programs process high-level languages into low level languages: interpreters and compilers.

An interpreter reads a high-level program and executes it, processing the program a little at a time, alternatively reading lines and performing computations:

Source code -> Interpreter -> Output

A compiler reads and translates the whole program before the program starts running. In this case, the high-level program is called the source code, and the translated program is called the object code or executable. Once a program is compiled, it can be executed repeatedly without further translation:

Source code -> compiler -> Object code -> Executor -> Output

Many languages use both processes. Programs are first compiled into a lower-level language called bytecode(pyc files for Python), and then interpreted by a program called a virtual machine.

There are two ways to use the Python interpreter: shell mode and script mode. In shell mode, statements are typed into the Python shell and the interpreter immediately posts the result. Shell mode begins with the Python prompt, ">>>", and is good for testing short bits of code, because it provides immediate feedback.

In script mode, a program is written into a file and the interpreter is used to execute the contents of the file. This is called a script. Anything longer than a few lines should be put into a script.

Files that contain Python programs end in .py

A program is a sequence of instructions that specifies how to perform a computation. A few basic instructions are:
  • input: get data from keyboard, file, or something else
  • output: display data on screen or send data to a file or elsewhere
  • math: perform basic mathematical functions
  • conditional execution: check for certain conditions and execute the appropriate sequence of statements
  • repetition: perform the same actions repeatedly, usually involving some sort of variation

Programming errors are called bugs, and the process of tracking down and correcting bugs is called debugging.

Three kinds of errors can occur in a program:

  • syntax errors: A program can only be executed if it is syntactically correct, otherwise an error message is returned. Syntax is the structure of a program and the rules about that structure. A syntax error occurs when a rule about the program structure is violated.
  • runtime errors: An error does not appear until the program is run; runtime errors are also called exceptions, usually indicating that something exceptional (and bad) has happened.
  • semantic errors: The program will successfully run, and doesn't generate an error message, but it will do the wrong thing (something other than what was intended). With a semantic error, the meaning of the program (its semantics) is wrong. To identify a semantic error, it is required to work backwards from the program output.

Debugging: information about errors -> inference -> hypothesis -> program modification

Natural languages
are languages that people speak, which evolved naturally. Formal languages are languages designed for specific applications.

Programming languages are formal languages that have been designed to express computations. Formal languages usually have strict rules about syntax.

Syntax rules pertain to either tokens or structure.

Tokens are the basic elements of a language, analogous to a word in a natural language.

The structure of a statement is the way in which tokens are arranged.

Examination and analysis of the structure of a program is called parsing.

Lets compare natural and formal languages.
  • Ambiguity: natural languages have ambiguity; formal languages are nearly or completely unambiguous
  • Redundancy: natural languages have redundancies/nuances; formal languages are more concise
  • Literalness: natural languages employ idioms and metaphors; formal languages mean exactly what they say
The meaning of a computer program is unambiguous and literal, and can be completely understood through analysis of the tokens and structure of the program.

Hello world:

Code:
>>> print ("Hello, World!")

The output should be:

Code:
Hello, World!
 
Last edited:
  • #30
If anyone spots any errors, or has anything to say about the content of "Day 1 of Python", feel free to correct or educate me. =)
 
  • #31
Ah, good old "Hello world".

Don't take this the wrong way, but it looks like you've just copied a textbook.

I'd say your best bet is to only post the code you want checked. Otherwise this thread is going to go crazy with every little detail of what you have read.

Otherwise, a good start. Good luck with learning it.

Out of curiosity, what sort of development are you looking to do with python in the future?
 
  • #32
G037H3 said:
Files that contain Python programs end in .py
This is only convention, not a necessity. My python scripts usually do not have any extension, but I do Python mainly under Linux.

About debugging. Things can get very hairy sometimes. Experience is quite valuable when you have to fix bugs. Don't be discouraged if you can't find where a bug is hiding. Even most experienced people can spend weeks to fix a bug.
 
  • #33
jarednjames said:
Ah, good old "Hello world".

Don't take this the wrong way, but it looks like you've just copied a textbook.

I'd say your best bet is to only post the code you want checked. Otherwise this thread is going to go crazy with every little detail of what you have read.

Otherwise, a good start. Good luck with learning it.

Out of curiosity, what sort of development are you looking to do with python in the future?

I already stated I was going through a book. I just condensed the material and rewrote some of it, to show what I've learned so far.

Maybe I *want* to show what I've read. It's my thread.

Iunno. Maybe Django.
 
  • #34
Upisoft said:
This is only convention, not a necessity. My python scripts usually do not have any extension, but I do Python mainly under Linux.

About debugging. Things can get very hairy sometimes. Experience is quite valuable when you have to fix bugs. Don't be discouraged if you can't find where a bug is hiding. Even most experienced people can spend weeks to fix a bug.

I can't change it now. :( Maybe if I ask a mod, they'll let me edit it. ._.

And I sort of wish to avoid spending that amount of time messing with mistakes. :)
 
  • #35
G037H3 said:
And I sort of wish to avoid spending that amount of time messing with mistakes. :)

"Messing with mistakes" -- debugging -- comes with the territory. Being able to write good code that has no bugs requires attention to detail, among other attributes.
 
  • #36
G037H3 said:
Hello world:

Code:
>>> print ("Hello, World!")

The output should be:

Code:
Hello, World!
Just checking -- you actually ran this program to see that it gave the output, right? :smile: It might be worth doing it (or some other simple program) both from the interpreter and by writing a script -- if nothing else, just to make sure you are actually capable of using python both ways.
 
  • #37
Mark44 said:
"Messing with mistakes" -- debugging -- comes with the territory. Being able to write good code that has no bugs requires attention to detail, among other attributes.

True, but I think that thinking before writing will help a lot. :P
Just checking -- you actually ran this program to see that it gave the output, right? It might be worth doing it (or some other simple program) both from the interpreter and by writing a script -- if nothing else, just to make sure you are actually capable of using python both ways.

I did in interactive mode. I haven't done it as a script yet. I just tried and apparently the syntax I used was incorrect.
 
  • #38
G037H3 said:
True, but I think that thinking before writing will help a lot. :P
That pretty much goes without saying. If you're working on small programs, it's easier to comprehend what the entire program is doing. With a little bit of experience, you can write small programs without bugs.

As programs get larger, with more involved logic, you might be able to write code without syntax errors, but such programs are much more likely to have semantic errors. The compiler/interpreter can always catch syntax errors, since you are using the language incorrectly, but semantic errors, which stem from flaws in your logic, are more difficult to find. It's a fact of life that programmers write code with errors.
 
Last edited:
  • #39
Here are some suggestions that I hope transcend programming in general regardless of language, platform, and other important elements.

1) State

The first thing you should be aware of in any program is its state. It doesn't matter if you're writing code for a HTML page or something in C++, you need to know the entire state of the machine relevant to your program.

The more complex your program the bigger the state you will need to know. Once you get to understanding all the state variables in your code and how they evolve over time, you will become a better programmer.

In relation to state, you not only need to know the variables that you deal with, but you have to know how to handle every effect that these variables have on your program.

The above might sound obvious, but for the sake of getting things done, lots of mistakes/bugs are caused simply because certain states of the system are not handled correctly.

2) Learn a popular assembly language

Most high level languages are useful and its not often economically feasible to write programs big or small in assembly language.

Never the less you should understand the architecture of a common platform, and to do that you will need to learn the relevant assembly language.

Everything from interrupts, to ports, to math operators, rotations and shifts, conditional jumps, calls, the stack, registers, basically everything for a common platform will help you learn all the stuff that aid you to understand how high level languages work in relation to the architecture of the physical platform.

3) Structure

Once you know a platform and how to handle and understand the state of a platform (this could be the local machine architecture, or perhaps a web platform, or a virtual machine etc), you need to understand structure.

Structure is everything. You want to send data over a network? It has structure. TCP/IP reliable messages have structure. Unrealiable UDP packets have structure.

Multimedia files have structure. Images, audio, video, text, everything has an inherit structure.

Look at different kinds of structures. Also look at something like XML or some other container based structural format and incorporate something similar in your programs. An open container based structure like XML allows a kind of "plug-in override" that let's you add functionality through new tokens and combined with a good-plugin architecture allows good additions to systems without having to re-write the fundamental core.

4) Learn about plug-in, expandable architectures

Well written programs allow easy expansion of a system, with minimal changes to the systems core.

Look at things like Microsofts Component Object Model, CORBA, and .NET and look at how extensible/plug-in systems are made.

The reason for this is that you want to make programs that build on other systems where integration between systems is as seemless as possible. If you ever get a job as a developer you will often have very complex systems, easily going over a million lines of code where you will have to integrate many different libraries that have a specialized set of functionality.

The good systems are the ones that allow easy integration as well as addition of features whereby the core of the system minimally changes: Do this and you will be not only a good programmer but a good software architect.

5) Structure II: Abstraction

Building on the ideas of expandable architectures and data structures I, you will want to learn about abstract data structures.

Things such as templates, and common container structures is at the heart of "abstract structures". Things like linked lists, queues, stacks, arrays, directed acyclic graphs, hash tables, class factory and plug-in template classes and so on contribute to you writing code that is short and has wide application.

This leads to my next point:

6) Write code that is as general as possible

You want to get into the habit of creating libraries that have general functionality.

You will create more specific code obviously that meets the needs of your program, but you do not want to write the same thing twice because a) its unnecessary and b) it takes more time to keep a particular function generalized meaning that if something goes wrong it can happen in more than one place in comparison to when you have a general template, or library where the code is centralized and thus helps you fix any problems and confines your errors to a particular code segment and not many.

Hopefully these tips should give you something to think about, and all the best with your learning
 
  • #40
G037H3 said:
I sincerely believe that Python is better as a first language, because the focus is on applications, not explaining syntax. It's self-evident.

Don't fall into this trap. There is a little saying: you can spend your time learning mathematics and then spend the rest of your life learning applications, or you can learn applications and spend the rest of your life learning math. Programming isn't much different. Many people can learn how to program, but what makes certain programmers exceptional is their ability to truly understand a language and mathematics in order to achieve optimization and effectiveness. This will require you to stop complaining and to learn details.
 
  • #41
It's better to have three programs that had bugs that were found and fixed than it is to have one program that never had bugs at all. At some point it becomes counter-productive to take great pains to avoid making bugs.

Believe it or not, debugging is not the hard part -- the hard part is design. Many hard debugging problems are the result of poor design that obscures bugs and makes them easy to write. Many other bugs are incorrectly designed code, rather than code that was implemented incorrectly.



One of the big tricks to programming is how to write code that makes it easy to detect and diagnose bugs, and how to write code that is difficult to use incorrectly.
 
  • #42
I acquired the Boole book. ^_^
 
  • #43
G037H3 said:
True, but I think that thinking before writing will help a lot. :P

Thinking tends to help always, but avoiding bugs is not worth time spent. Also, people usually work in groups and no one has all the knowledge for the project. If you work alone you still can produce bugs depending on the size of the project, amount of alcohol and fatigue.

Friend of mine got home very drunk and decided to write some code. At morning he found that the code is syntactically perfect (no warnings or errors during compilation), but semantically it was total crap.
 
  • #45
Oh, I don't have that sort of attitude, though I do wish to prepare myself mathematically for Knuth >.<
 
  • #46
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

------------------------------------------------------------------------------------
Code:
print(sum([x for x in range(1000) if x % 3 == 0 or x % 5 == 0]))

List comprehensions; u jelly?
 
  • #47
Did the code work (I don't use python)?
 
  • #48
jarednjames said:
Did the code work (I don't use python)?

yep :)
 
  • #49
Are you trying out various functions? Or are you actually building a piece of software to do something (even relatively simple)?

I ask, because I find myself better at learning whilst doing. I can't book study because it just doesn't sink in.

I'd also add that as nice as learning from a book is, until you can apply it to real world scenarios it's pretty much useless.
 
  • #50
jarednjames said:
Are you trying out various functions? Or are you actually building a piece of software to do something (even relatively simple)?

I ask, because I find myself better at learning whilst doing. I can't book study because it just doesn't sink in.

I'd also add that as nice as learning from a book is, until you can apply it to real world scenarios it's pretty much useless.

I play a lot, mixing and matching. I'll write something one way and then try to think of two other ways of doing the same thing. Right now, I'm doing lots of stuff with lists and dictionaries, convoluted manipulations. I'm starting to move towards making useful stuff though. :)
 
Back
Top