Re: About programing, a general question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/21/2010 03:48 PM, Parshwa Murdia wrote:
> On Wed, Dec 22, 2010 at 12:24 AM, Jerry Feldman <gaf@xxxxxxx
> <mailto:gaf@xxxxxxx>> wrote:
>
>     I learned C from K&R, from the tutorial that was included with
>     Unix, and
>     the fact that I was told I had to maintain the Unix CShell.
>     Fortunately
>     at the time I knew a number of languages including IBM 360/370,
>     AutoCoder, Burroughs, PDP-8, PDP-11, and Raytheon PTS1200/PTS100
>     assembly. My real learning experience was looking at the code
>     generated
>     by COBOL. You can see how some compilers generate the code, but
>     you can
>     also see how some decisions you make at the high level language affect
>     the actual code. I was taught that looping through an array by using
>     pointers was much faster than subscripting through the same array.
>     BUT,
>     when working with the compiler group on Tru65 Unix I found that
>     subscripting was actually much faster when using an optimizing
>     compiler
>     because the compiler must dereference every pointer, but when
>     subscripting, it can keep the array base in a register. I had some
>     old C
>     code that I used to first test that pointers are better than
>     subscripting, and I then tested that in the Tru64 compiler on the
>     Alpha,
>     and subscripted loops were faster.
>
>     Basically, the first rule I always use is to write code clearly and
>     concisely. Remember that someone (you or someone else) may have to
>     debug
>     it. If you need to make the code work faster, then is the time to
>     analyze, and we have some really neat tools like graphical profilers
>     that can point out bottlenecks, and many times these surprise even the
>     most experienced programmers.
>
>     Basically, the CPU generally does a few things. While there are major
>     differences, between CISC and RISC, you load an address into a
>     register,
>     perform some operation on that register, such as add, subtract,
>     multiply, divide, or, not, and, and a few more. Then you save the
>     contents into memory. Of course there are branch and conditional
>     branch
>     where you go to a different part of the code based upon a true or
>     false
>     condition. To really understand computer logic, an interesting
>     approach
>     is to build a computer using plugboard parts. Remember, everything
>     in a
>     computer is binary not decimal, not octal (3 bit representation of
>     binary), not hexadecimal (4 bit representation).
>
>     --
>     Jerry Feldman
>
>
>
> This is much related with Assembly language.
>
>
Yes and no. It is related to an understanding of what a computer really
does. While CPUs today are very complex, such as out-of-order execution,
the basic underlying premise is the same. If you understand binary
arithmetic and logical arithmetic, then you have an understanding of
what a CPU really does. You certainly don't need to understand what an
or gate or and gate is, but you need to understand what happens when you
add 2 positive integers and get a negative result, or when trying to
print out a double precision float beyond the 15th decimal digit where
the same calculation in Excel or OpenOffice calc rounds at the 15th digit.

While this discussion really has been not Fedora related, Fedora
supports all the programming languages discussed here. Decide what
programming language you want to start with (ignore religionists), and
simply get an online tutorial. Once you have a firm grasp of the
concepts of programming, you can move on to things like OOP.

-- 
Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846


Attachment: signature.asc
Description: OpenPGP digital signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux