more microcrap

formatting link

The "20,000 lines of source code" turns out to be a 104 megabyte zipped download, 395 files. Looks like most of the work is actually done in zillions of dll's.

An actual source file looks like...

//----------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All Rights Reserved. // //----------------------------------------------------------------------------- using System; using System.IO; using System.Globalization; using System.Runtime.InteropServices; using System.Text; //^ using Microsoft.Contracts;

// Left over work items: // 1) Try to optimize String reading and writing methods

#if !BIGENDIAN && !LITTLEENDIAN #error Either BIGENDIAN or LITTLEENDIAN must be defined. #endif

namespace Microsoft.Cci.UtilityDataStructures { unsafe struct MemoryBlock { internal readonly byte* Buffer; internal readonly int Length; internal MemoryBlock( byte* buffer, int length ) { this.Buffer = buffer; this.Length = length; } internal MemoryBlock( byte* buffer, uint length ) { this.Buffer = buffer; this.Length = (int)length; } }

unsafe internal struct MemoryReader { #region Fields //^ [SpecPublic] readonly byte* Buffer; //^ [SpecPublic] private byte* CurrentPointer; internal readonly int Length; // ^ invariant this.CurrentPointer >= this.Buffer; // ^ invariant this.CurrentPointer 0; // ^ invariant this.Buffer != null; // ^ invariant this.CurrentPointer != null; #endregion

#region Constructors internal MemoryReader( byte* buffer, int length, int offset ) //^ requires buffer != null; //^ requires offset 0; { this.Buffer = buffer; this.CurrentPointer = buffer + offset; this.Length = length; }

and so on. Garbage.

John

Reply to
John Larkin
Loading thread data ...

It is something of a first that they have released sourcecode at all.

I am not going to try and defend a coding style that is as ugly as hell and without any summary description of the module or indication of revision number, date last modified, changes, by who or when.

[snip]

But this is actually faintly interesting. They are using design by contract which helps static testing find more faults at compile time and automated dynamic unit testing suites to probe more efficiently.

Even I find it hard to stick up for the ugly MS syntactic sugar. But they do deserve some credit for Microsoft.Contracts

formatting link

Note that these tools are only present in the upmarket Team Systems version. They should be included in the teaching version with a hard limitation on the maximum size of project. How will the next generation learn to do things better if they do not have decent tools to learn on?

Regards, Martin Brown

Reply to
Martin Brown

On a sunny day (Tue, 21 Jul 2009 08:17:28 -0700) it happened John Larkin wrote in :

this.code = sucks,

Reply to
Jan Panteltje

On a sunny day (Tue, 21 Jul 2009 16:55:17 +0100) it happened Martin Brown wrote in :

They would have to start coding in asm.

Whatever the reason may be, lawyers, or simple insanity, or corporate protection schemes, it seems 'future generations of programmers' will be given some very high level GUI window --?? where to type 'Hello world, I want a program'.

The system bloat will then generate a program, after that ask what it should do :-)) The code will then be modified for just that purpose :-)

Really, if you want to write for google cellphone OS, or even Nokia, you need to start downloading eclipse... Java too, because they are afraid if you do C or asm in that phone you can get cheap calls?? There is no fun in programming like that.

I have even enough problems getting ffmpeg in Linux doing what I want, try grabbing an x window with it, seems something went wrong there, no way will I like working in some bloated GUI environment. That is why Visual studio sucks too.

Microsoft and Linux? as Linux gets more accepted... sure... adding the MS code to it is the best way to destroy it!

Reply to
Jan Panteltje

you.guys = retards; }

Reply to
Archimedes' Lever

Archimedes' Lever a écrit :

Maybe, but you're the template.

--
Thanks,
Fred.
Reply to
Fred Bartoli

Weird release info too. The Reg says this will be part of 2.6.30.1 which came out July 2nd already. Maybe they have a time machine now?

Anyways, the actual Linux Hyper-V stuff in diffs is viewable at

formatting link
for example. Looks like typical Linux driver code to me.

Reply to
Anssi Saari

Everyone doing a degree in computer science should learn at least one assembler, a couple of the historic languages and one current trendy language to have a decent perspective on things. They should not be trade schools for C or Java coders.

protection schemes,

It may be that a graphical join the boxes specification of computer software rather like an electronic circuit diagram will be one way forwards.

do :-))

To be fair I ran a few versions of that benchmark that Larking was on about - including the two obvious pointer and for loop C styles. The latest Microsoft optimising compiler reduced them to identical graphs and eliminated the code for one of the routines entirely!

to start downloading eclipse....

cheap calls??

In some environments the programmer needs to be prevented from doing naughty things.

grabbing an x window with it,

GUI environment.

I am no great fan of GUIs but it is what everybody wanted.

way to destroy it!

That could be their plan - an MS Trojan horse to destroy Linux reliability.

Regards, Martin Brown

Reply to
Martin Brown

wn

?

The skill of programming and the skill of coding are two different things. I think that the assembler could be on something like a PDP-8 or a PIC. The low instruction count means that not much time will be wasted on learning the instructions of a specific machine.

The assembler code should be so that it has to do something useful. These days, the assembler code should include coding up a virtual method dispatch.

rotection schemes,

gh

ds.

A compiler that takes in something like a dataflow diagram and makes ood code out would be very hard to write but if it existed it may be useful.

hould do :-))

=A0you need to start downloading eclipse....

can get cheap calls??

try grabbing an x window with it,

bloated GUI environment.

best way to destroy it!

y.

Reply to
MooseFET

... while circuit diagrams end up as VHDL/Verilog.

I'm not sure that security is really the issue. The CPUs used in cellphones are perfectly capable of isolating user code from the OS.

I suspect that it may have more to do with being able to change the hardware, OS, libraries etc at will, yet the Java bytecode files will continue to work.

Reply to
Nobody

I reckon they should be made to learn Mix. The original poly-unsaturated machine language. Although PICs would do since they are Harvard architecture which I reckon is another important thing to know about.

I don't know about that. Most of the programming tasks I did at university were not obviously useful but were challenging.

N queens is a good one - doable in registers on a 64bit machine today for an 8x8 board (next task is a 9x9 board).

I reckon for assembler there should be a choice of two or three projects with apparently similar levels of difficultly but designed so that only one of them is significantly easier in assembler.

protection schemes,

The hard bit is making the two stay in sync when people alter the ood code (which tends to be inevitable). Compilers are getting better but the practitioners sadly are not. Same old mistakes today as thirty year ago. The coherence length of screen written code is now longer than 25 lines which is I suppose an improvement of sorts.

Regards, Martin Brown

Reply to
Martin Brown

Somewhere in between is possibly the perfect solution.

I think there is an argument in favour of having tools that can look at the sourcecode representation of a program graphically. And vice versa - domain experts tend to be able to follow and check diagrams more easily than they can sourcecode. You need to be able to change either representation and have the changes reflected in the other.

Abstraction layers can do wonderful things, and on today's fast hardware you hardly notice the performance hit. Java is cute.

Regards, Martin Brown

Reply to
Martin Brown

rown

on?

8

It may also be useful to make a special case very simple pipelined processor. Understanding that the results may not be ready at the start of the next instruction is also a useful to teach about.

I like the "useful" rule because it can be used to teach about understanding real problems.

[....]

Many years back I helped a guy write a program that took in source code and made a flow chart. One of the hardest parts is planning out where the blocks go. It is sort of like a PCB layout program doing an auto route but where the components (the blocks) being pushed by the traces.

If the code is changed, the blocks in a data flow or a flow chart would want to move. The real tricky bit would be making the moves not turn the users chart into something he can no longer read.

I think that the trick would be to give each thing in the chart a "cost". Crossing two lines would cost. Every bend in a trace would be a slightly lower cost. A arrow entering a block from below would have a cost a little more than entering on the right.

The code for making changes could try to always make the change that produces the lower cost.

Reply to
MooseFET

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.