Home | Community | Message Board

Sporeworks
This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: Kraken Kratom Red Vein Kratom   PhytoExtractum Buy Bali Kratom Powder

Jump to first unread post Pages: < Back | 1 | 2  [ show all ]
Invisiblefushock
 User Gallery
Registered: 10/14/07
Posts: 428
Re: spaghettification of code... [Re: Annapurna1]
    #9020554 - 10/02/08 09:08 PM (15 years, 3 months ago)

Same things that make bad code
1. People designing things they should not be designing.
2. Reusing old, bad code and making it do things it wasn't intended to do.
3. Last minute spec changes that significantly change the backed.
4. Specs designed by groups of people.
5. Improper choice in project programming languages.
6. Lack of communication between designers and coders.
7. Unrealistic deadlines.
8. Many different, stubborn people touching the same code and doing things their own way.
...
n. Contractors who don't really seem to care about maintainability. My opinion.


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero


Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 19 days
Re: spaghettification of code... [Re: fushock]
    #9022294 - 10/03/08 04:58 AM (15 years, 3 months ago)

> 1. People designing things they should not be designing.

Big huge pet peeve of mine.  These are usually people that were book smart and able to memorize well, but have never coded a line in their life and wouldn't know big O(x^n) if it hit them on the head.  Great, they can draw out use cases, can make pretty pictures with UML, and can point to a pattern in some obscure book that matches.  What does functional complexity matter when they have all of this to back up their design?

> 4. Specs designed by groups of people.

Groups aren't necessarily bad.  One of the best designs I ever worked on was done by two people.  He understood the problem and I understood the programming.  We would get into some pretty heated debates about which direction to go, but in the end the design was solid (and the code is still in use today, ten years later).  Easy to maintain and scaled well while meeting almost all of the customers needs.  Committees that compromise without understanding the implications of the compromise tend to yield broken designs... which are fixed in code, resulting in a mess that no longer matches the design.

> 6. Lack of communication between designers and coders.

Another big one, but is typically caused by #1 above with respect to designers that have never coded and coders that loathe designers that have never coded.

I would add:

n+1: Requiring the coders to write test cases for their own code.  Much like proofreading your own writing, it simply doesn't work very well.  The designers (or a completely separate group) should be writing the test cases to ensure that the code provided implements the design as specified.


--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
InvisibleDiploidM
Cuban


Folding@home Statistics
Registered: 01/09/03
Posts: 19,274
Loc: Rabbit Hole
Re: spaghettification of code... [Re: Seuss]
    #9027482 - 10/04/08 07:50 AM (15 years, 3 months ago)

When I used to write code that ran airliners in real time, bugs of any kind were absolutely unacceptable. Our code was 100% perfect every time. Imagine a misplaced ++ bringing down an airliner!

In that regulated development environment, it was literally illegal for a coder to even discuss the project with a tester, let alone for a coder to test his own code.

It was perfect code, but it did take us two months to produce as much code as most people produces in a day.


--------------------
Republican Values:

1) You can't get married to your spouse who is the same sex as you.
2) You can't have an abortion no matter how much you don't want a child.
3) You can't have a certain plant in your possession or you'll get locked up with a rapist and a murderer.

4) We need a smaller, less-intrusive government.


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero


Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 19 days
Re: spaghettification of code... [Re: Diploid]
    #9027619 - 10/04/08 09:08 AM (15 years, 3 months ago)

> Our code was 100% perfect every time.

Did they use formal verification (mathematical proofs) on the design?  I would suspect so if it was that mission critical.


--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
InvisibleDiploidM
Cuban


Folding@home Statistics
Registered: 01/09/03
Posts: 19,274
Loc: Rabbit Hole
Re: spaghettification of code... [Re: Seuss]
    #9028484 - 10/04/08 01:06 PM (15 years, 3 months ago)

Actually, it went farther than that. This was all done according to an FAA standard called DO-178B which strictly defines the entire development environment from requirements to flight testing.

The requirements were written in a structured language that was machine-readable. This was verified by two independent teams who didn't interact. This went on to two new teams who produced the design specs, again in a structured language. And again two teams validated the design plus a comparator algorythm corollated requirements with specs so nothing could be missed by the humans.

Next it went to coders who worked on modules that were effectively black boxes as far as they were concerned.

Finally, a machine generated all the test cases and wrote the test code and human-readable instructions from the initial requirements, which is why they were originally written in a structured language.

All of this was managed by a database and an integrated environment which ITSELF was developed according to the DO-178B standard. Every tool, even the text editors, OS, and physical hardware used had to be DO-178B certified or it couldn't legally be used in the development process. It goes without saying that no Windows machines were used other than for sending email and scheduling meetings.

So the short answer is yes, everything from the structured requirements through the final flight test was mathematically cross-linked so there were never any mistakes possible.

That said, DO-178B is flexible enough that exceptions are allowed at any stage as long as a committee of the relevant engineers signed off on any exceptions and they're carefully accounted for in the final certification.

This human element in the chain is the most risky. The only fatal failure of software in an airliner that I'm aware of occurred about 10 years ago when just such an exception was made and somehow overlooked by dozens of engineers. It lead to the uncommanded deployment of the thrust reverses on a Boeing 767 in flight which killed a bunch of people.


--------------------
Republican Values:

1) You can't get married to your spouse who is the same sex as you.
2) You can't have an abortion no matter how much you don't want a child.
3) You can't have a certain plant in your possession or you'll get locked up with a rapist and a murderer.

4) We need a smaller, less-intrusive government.


Extras: Filter Print Post Top
Offlinedelta9
Active Ingredient
Male

Registered: 10/28/04
Posts: 5,390
Loc: California
Last seen: 13 years, 3 months
Re: spaghettification of code... [Re: Diploid]
    #9029615 - 10/04/08 06:26 PM (15 years, 3 months ago)

What language was the code written in and did they formally prove the code itself (not just the design)?  Some languages/programs are simply easier to prove than others - some are impossible.


--------------------
delta9


Extras: Filter Print Post Top
InvisibleDiploidM
Cuban


Folding@home Statistics
Registered: 01/09/03
Posts: 19,274
Loc: Rabbit Hole
Re: spaghettification of code... [Re: delta9]
    #9029688 - 10/04/08 06:59 PM (15 years, 3 months ago)

What language was the code written in

C. Last I heard C++ was nearing approval and should be formally allowed by the end of the decade. The FAA is very conservative.

and did they formally prove the code itself (not just the design)?

Yes. There were code reviews. This too followed strict guidelines. The acronym was SWII (SoftWare Intensive Inspection) and consisted of exactly four people. The coder, a moderator, a secretary (took notes of and submitted any issues found), and a critic. The critic was primarily tasked with line-by-line analysis of the code, though in practice, all four did this.

No SWII session was allowed to exceed 45 minutes. At 45 minutes, everyone was required to take a 15 minute break so everyone was always fresh. Any changes that resulted from the SWII (there rarely were any) were submitted to the defect tracking system, the fix was analyzed, designed, approved, submitted, then reSWIId before it went into the production system.

I'm lucky not to have to work any more, but when I did, that rigor was refreshing compared to how sloppy most software development was at the time (and probably still is).


--------------------
Republican Values:

1) You can't get married to your spouse who is the same sex as you.
2) You can't have an abortion no matter how much you don't want a child.
3) You can't have a certain plant in your possession or you'll get locked up with a rapist and a murderer.

4) We need a smaller, less-intrusive government.


Extras: Filter Print Post Top
Offlinedelta9
Active Ingredient
Male

Registered: 10/28/04
Posts: 5,390
Loc: California
Last seen: 13 years, 3 months
Re: spaghettification of code... [Re: Diploid]
    #9031101 - 10/05/08 02:49 AM (15 years, 3 months ago)

Quote:

Diploid said:
What language was the code written in

C. Last I heard C++ was nearing approval and should be formally allowed by the end of the decade. The FAA is very conservative.



Let's hope they stay away from C++, then.  It is terribly fast and loose (far from conservative) and is very difficult to parse without a lot of context and thus very difficult to formally prove.

Quote:

and did they formally prove the code itself (not just the design)?



It sounds like they maintained very rigorous and excellent development and testing practices; however, this is not a formal proof of a program.

Quote:

I'm lucky not to have to work any more, but when I did, that rigor was refreshing compared to how sloppy most software development was at the time (and probably still is).



Yes you were quite lucky to work there because even now there is little to no rigor in implementing and following up with QA, formal proofs, or even security audits.


--------------------
delta9


Extras: Filter Print Post Top
InvisibleDiploidM
Cuban


Folding@home Statistics
Registered: 01/09/03
Posts: 19,274
Loc: Rabbit Hole
Re: spaghettification of code... [Re: delta9]
    #9031464 - 10/05/08 07:29 AM (15 years, 3 months ago)

however, this is not a formal proof of a program

I forgot to mention that the automated system combed through the code and formally proved the logic as it generated test cases. For example, every 'if' statement produced at least two tests and an abstract (mathematical model). If the 'if' statement was compound statement like if (a && (b || c) ) then it would generate at least nine test cases, usually more. One for a, b c, another for a, b, not c, another for a, not b, c, and so on. The logic was proved through this testing mechanism and validation of the abstract.

In practice, there are five levels of rigor, A through E. E level is used for things like the toilet, where a fatal flaw will cause only inconvenience to the passengers and crew. Level A was the most critical and applied to navigation systems, engine control computers, and so on. Level B applied to communications radios that had independent backups. Only level A was exhaustively proved.

This proofing requirement is one obstacle to C++ as you mentioned, though they are working on it last I heard.


--------------------
Republican Values:

1) You can't get married to your spouse who is the same sex as you.
2) You can't have an abortion no matter how much you don't want a child.
3) You can't have a certain plant in your possession or you'll get locked up with a rapist and a murderer.

4) We need a smaller, less-intrusive government.


Extras: Filter Print Post Top
Offlinedelta9
Active Ingredient
Male

Registered: 10/28/04
Posts: 5,390
Loc: California
Last seen: 13 years, 3 months
Re: spaghettification of code... [Re: Diploid]
    #9040065 - 10/06/08 11:46 PM (15 years, 3 months ago)

That is truly epic!  I, for one, am in awe.  Actually ENGINEERING programs!  Just think if more software was held to higher standards...  C++ is held to a moving and loose standard that makes things very difficult to work with in a provable and portable manner.  Hopefully they figure out there is little to no benefit to using C++ over C for what they are doing.  Managers caught up in marketing!


--------------------
delta9


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero


Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 19 days
Re: spaghettification of code... [Re: delta9]
    #9040639 - 10/07/08 04:06 AM (15 years, 3 months ago)

All of the above, based upon my limited understanding (I'm not a formals person), still doesn't prove the validity of the design.  It certainly ensures that the code implements the design correctly.

An example would be with the C++ language.  There are a couple of places in the semantic definitions that leave ambiguity and can be implemented differently and still meet the design criteria of the specification correctly.  Given the statement "i=5, func(i, ++i)", func might receive the values of 5 and 5 or 5 and 6 depending upon the implementation of the compiler.  Both are correct by the definitions provided in the specification for the language (because of ambiguity, not intent).

Regardless, a very impressive system they have and amazingly complex.  It must suck having to recertify the compiler every time a new hardware type/processor is added.  Do they use other languages to interface to the low level hardware (forth), or implement through library calls within C?  Even then, they would need assembly, which opens a new round of verification problems.  Ick.


--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero


Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 19 days
Re: spaghettification of code... [Re: Seuss]
    #9040761 - 10/07/08 05:38 AM (15 years, 3 months ago)

Regarding the accident that Diploid mentioned above (I think)...

http://catless.ncl.ac.uk/Risks/12.69.html:
Quote:

Smith said he told Boeing officials the software could trigger a rogue signal that would cause the plane's computer-driven systems to malfunction.  But Smith said Boeing officials in charge of the troubleshooting program told him they "didn't want to get anybody excited" and ordered him to omit any mention of potential system-wide problems resulting from the flawed
software from his formal report.




...

Quote:

Smith, ..., said he told Boeing officials the software contained an "architectural flaw" that could lead the unit to send a random signal to other electronic systems within a jetliner, providing them with false information.  So poorly designed was the PSEU software, he said, that he recommended that it be completely redesigned.




...

Quote:

For example, Smith said, the control unit could notify the rest of the electronic subsystems that the plane's landing gear was down while the plane was still in flight.  That would cause the auto-restow to switch to a ground-speed mode check, Smith said.  The system would then "see that the aircraft was going too fast, and kick in the reverse thrusters -- while the aircraft was really in flight.




...

Quote:

Smith said that Boeing passed on the report to Eldec Corp. of Lynnwood, which wrote the software for the company, and the findings were independently verified by other Boeing computer experts.  The report says Eldec's software violated seven of Boeing's own software specification..  "This problem ... is a very real and serious impediment to the correct operation of the PSEU," it concludes.




--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
Offlinesupra
computerEnthusiast
Registered: 10/26/03
Posts: 6,446
Loc: TEXAS
Last seen: 12 years, 9 months
Re: spaghettification of code... [Re: Seuss]
    #9045505 - 10/07/08 10:38 PM (15 years, 3 months ago)

Quote:

Seuss said:
All of the above, based upon my limited understanding (I'm not a formals person), still doesn't prove the validity of the design.  It certainly ensures that the code implements the design correctly.

An example would be with the C++ language.  There are a couple of places in the semantic definitions that leave ambiguity and can be implemented differently and still meet the design criteria of the specification correctly.  Given the statement "i=5, func(i, ++i)", func might receive the values of 5 and 5 or 5 and 6 depending upon the implementation of the compiler.  Both are correct by the definitions provided in the specification for the language (because of ambiguity, not intent).

Regardless, a very impressive system they have and amazingly complex.  It must suck having to recertify the compiler every time a new hardware type/processor is added.  Do they use other languages to interface to the low level hardware (forth), or implement through library calls within C?  Even then, they would need assembly, which opens a new round of verification problems.  Ick.




hmmm...i wonder why they didn't go ahead and implement (well, not implement, but specify in design) the pre-increment ( ++i ) and post-increment ( i++ ) more strictly?

peace


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero


Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 19 days
Re: spaghettification of code... [Re: supra]
    #9046483 - 10/08/08 05:57 AM (15 years, 3 months ago)

> i wonder why they didn't go ahead and implement (well, not implement, but specify in design)

I suspect it was an oversight, but don't really know.  When you are dealing with something as complex as the C++ language, it is very difficult to design it without missing something... this was just one example of several that are in the language specification.  A formal proof of the language would (in theory) catch these mistakes, but formal proofs are insanely difficult and time consuming, especially for something this large, thus very expensive.


--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
OfflineExplosiveMango
HallucinogenusDigitallus
Male User Gallery

Registered: 07/12/05
Posts: 3,222
Last seen: 14 years, 2 months
Re: spaghettification of code... [Re: zouden]
    #9048615 - 10/08/08 04:12 PM (15 years, 3 months ago)

Quote:

zouden said:
I love it when I see swearing in my own comments.




void DO_YOUR_DAMN_JOB(char *data, int correction);


I was once asked for advice on some code.
After seeing this function declaration all I could to tell the guy was "rewrite it."


--------------------
Know your self.
Know your substance.
Know your source.

The most distorted perspective possible is the perspective that yours is not distorted.


Extras: Filter Print Post Top
Jump to top Pages: < Back | 1 | 2  [ show all ]

Shop: Kraken Kratom Red Vein Kratom   PhytoExtractum Buy Bali Kratom Powder


Similar ThreadsPosterViewsRepliesLast post
* Statistics time: Programming Languages and Programmers
( 1 2 all )
delta9 4,325 26 05/16/07 12:17 PM
by SymmetryGroup8
* anyone else here code for a living?
( 1 2 all )
BrAiN 2,815 21 01/08/08 03:35 PM
by Diploid
* Format String Attack (you gotta be experienced with coding)
( 1 2 all )
Xeny 2,797 22 03/06/08 04:46 PM
by Diploid
* Programming neural nets ChuangTzu 860 6 07/27/05 05:19 AM
by ChuangTzu
* Program design help SeussA 1,522 8 05/04/07 09:11 AM
by phi1618
* i have a job for any programmer who is b0red enough 40oz 1,240 10 06/10/03 07:11 PM
by DF2K
* Any Programmers out there? MuffinBear 728 4 10/03/03 01:58 PM
by DF2K
* Japan/South Korea to program robots with 'code of morals' FrenchSocialist 1,450 8 03/10/07 03:07 PM
by supra

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
2,442 topic views. 0 members, 0 guests and 2 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.03 seconds spending 0.008 seconds on 14 queries.