際際滷

際際滷Share a Scribd company logo
Dear compiler: Please don't be my Nanny

Speaker Name
Dino Dini NHTV University of Applied Sciences
Nanny says:
Nanny says:
   Don't you ever use goto
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
   Might we suggest always saying new
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
   Might we suggest always saying new
   Fact is OOP should make you glad
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
   Might we suggest always saying new
   Fact is OOP should make you glad
   So you want overload?
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
   Might we suggest always saying new
   Fact is OOP should make you glad
   So you want overload?
   La la land's where weak typing goes
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
   Might we suggest always saying new
   Fact is OOP should make you glad
   So you want overload?
   La la land's where weak typing goes
   Ti's right to make everything private
Nanny says:
   Don't you ever use goto
   Regard preprocessors as bad
   Might we suggest always saying new
   Fact is OOP should make you glad
   So you want overload?
   La la land's where weak typing goes
   Ti's right to make everything private
   And that brings us back to Don't.
Don't you ever use goto
Don't you ever use goto
Contrary to popular belief, goto is not evil.
Sometimes it can be the right tool for the job, especially when:
Don't you ever use goto
Contrary to popular belief, goto is not evil.
Sometimes it can be the right tool for the job, especially when:

       Prototyping non production code
Don't you ever use goto
Contrary to popular belief, goto is not evil.
Sometimes it can be the right tool for the job, especially when:

       Prototyping non production code
       Trying to fix bugs in finished code with minimal risks
Don't you ever use goto
Contrary to popular belief, goto is not evil.
Sometimes it can be the right tool for the job, especially when:

       Prototyping non production code
       Trying to fix bugs in finished code with minimal risks
       Porting legacy code
Don't you ever use goto
Contrary to popular belief, goto is not evil.
Sometimes it can be the right tool for the job, especially when:

       Prototyping non production code
       Trying to fix bugs in finished code with minimal risks
       Porting legacy code
       Implementing state machines
Don't you ever use goto
If the code would have been clearer with a goto, then
perhaps a goto was the best thing to use.
Don't you ever use goto
If the code would have been clearer with a goto, then
perhaps a goto was the best thing to use.

Java does not support goto, but still reserves the
keyword. Adding goto support would take minutes, and
would not end the world.
Don't you ever use goto
If the code would have been clearer with a goto, then
perhaps a goto was the best thing to use.

Java does not support goto, but still reserves the
keyword. Adding goto support would take minutes, and
would not end the world.




                                          I Feel a disturbance in the Force...
Regard preprocessors as bad
Regard preprocessors as bad
I can decide for myself when it is appropriate to use macros or conditional
compilation.
Regard preprocessors as bad
I can decide for myself when it is appropriate to use macros or conditional
compilation.

Java does not even allow
conditional compilation,
and it is hilarious, the
hoops that you have to
jump through as a result.
Regard preprocessors as bad
I can decide for myself when it is appropriate to use macros or conditional
compilation.

Java does not even allow
conditional compilation,
and it is hilarious, the
hoops that you have to
jump through as a result.
Regard preprocessors as bad
Some legitimate uses:
Regard preprocessors as bad
Some legitimate uses:

   Porting legacy code
Regard preprocessors as bad
Some legitimate uses:

   Porting legacy code
   Avoiding repetitive boilerplate
Regard preprocessors as bad
Some legitimate uses:

   Porting legacy code
   Avoiding repetitive boilerplate
   Abstracting of identifiers
Regard preprocessors as bad
Some legitimate uses:

   Porting legacy code
   Avoiding repetitive boilerplate
   Abstracting of identifiers
   Implementing support for multitasking
Regard preprocessors as bad
Some legitimate uses:

   Porting legacy code
   Avoiding repetitive boilerplate
   Abstracting of identifiers
   Implementing support for multitasking
   Registration of string to object mapping
Regard preprocessors as bad
Some legitimate uses:

   Porting legacy code
   Avoiding repetitive boilerplate
   Abstracting of identifiers
   Implementing support for multitasking
   Registration of string to object mapping
   And much, much more stuff that's not computer sciency,
    but helps you Get Stuff DoneTM
Regard preprocessors as bad
C# learned the lesson of conditional compilation, but still will not let me use
macros. Which means more...
Regard preprocessors as bad
C# learned the lesson of conditional compilation, but still will not let me use
macros. Which means more...
Might we suggest always saying new
Might we suggest always saying new
It is a sad fact of life that programs have to allocate memory, which is
messy and slow and affects performance.

But to rub it in all the time is just plain senseless.
Might we suggest always saying new
It is a sad fact of life that programs have to allocate memory, which is
messy and slow and affects performance.

But to rub it in all the time is just plain senseless.

         Vector3 vec = current + new Vector3(1,2,3);

         DoSomethingImportant(        new Vector3(a,b,c),
                                      new Vector3(d,e,f),
                                      new Vector3(g,h,i));
Might we suggest always saying new
This is what would actually happen if experienced programmers were not
constantly reminded that doing stuff causes memory allocations:
Might we suggest always saying new
This is what would actually happen if experienced programmers were not
constantly reminded that doing stuff causes memory allocations:




                               Nothing....
Might we suggest always saying new
And it's not as if C# is consistent, is it?
Might we suggest always saying new
And it's not as if C# is consistent, is it?

You are forced to say new all the time, but can then create
accessors that could actually end the world through what looks like
an innocent variable read.
Might we suggest always saying new
  DebugOut ( fluffyKitten.name );
Might we suggest always saying new
  DebugOut ( fluffyKitten.name );
Fact is OOP should make you glad
Object orientated programming did not turn out to be the
cure for our ills.
Fact is OOP should make you glad
Are objects really the best building blocks of code?
Fact is OOP should make you glad
Are objects really the best building blocks of code?

How about keeping data and functionality separate
instead?
Fact is OOP should make you glad
Are objects really the best building blocks of code?

How about keeping data and functionality separate
instead?

The first thing an architect seems to do with OOP is
separate data from functionality through interfaces.
Fact is OOP should make you glad
Are objects really the best building blocks of code?

How about keeping data and functionality separate
instead?

The first thing an architect seems to do with OOP is
separate data from functionality through interfaces.

Compilers are generally designed around the OOP model,
making it harder to solve programming problems in
other ways.
Fact is OOP should make you glad
This means more...
Fact is OOP should make you glad
This means more...
So you want to overload?
So you want to overload?
Overloading functions and operators really can be very
useful, but many languages refuse to support them for
dubious reasons.
So you want to overload?
Overloading functions and operators really can be very
useful, but many languages refuse to support them for
dubious reasons.

Javascript does not even support overloaded functions.
So you want to overload?
Lets compare two pseudo code fragments:
So you want to overload?
Lets compare two pseudo code fragments:


        Vector3 N = ( pos1 - pos2 ) . Normalise();
        pos1 += N * speed;
So you want to overload?
Lets compare two pseudo code fragments:


        Vector3 N = ( pos1 - pos2 ) . Normalise();
        pos1 += N * speed;

        // or

        Vector3 N = NormaliseVector3( sub2Vector3( pos1,pos2 ));
        AddToVector3( ScaleVector3( N, speed ));
So you want to overload?
Lets compare two pseudo code fragments:


        Vector3 N = ( pos1 - pos2 ) . Normalise();
        pos1 += N * speed;

        // or

        Vector3 N = NormaliseVector3( sub2Vector3( pos1,pos2 ));
        AddToVector3( ScaleVector3( N, speed ));

Questions?
La la land's where weak typing goes
La la land's where weak typing goes
The only reason for strong typing is, let's face it, performance.
La la land's where weak typing goes
The only reason for strong typing is, let's face it, performance.

Why, oh why, does C# insist I put an f on my floats?
La la land's where weak typing goes
The only* reason for strong typing is, let's face it, performance.

Why, oh why, does C# insist I put an f on my floats?

         float f = 10.5;
         // come on compiler, be sensible
         // It feels like I spend most of my
         // fixing this when you complain




         * Disclaimer: This is a rant
La la land's where weak typing goes

    float f = 10.5;
La la land's where weak typing goes

    float f = 10.5;
    It's a constant! What on earth does the error serve?
La la land's where weak typing goes

    float f = 10.5;
    Here's what would happen if you relaxed...
La la land's where weak typing goes

    float f = 10.5;
    Here's what would happen if you relaxed...




                            Nothing....
La la land's where weak typing goes
    And this:
             Tank tank = GetObject("Tank") as Tank;
La la land's where weak typing goes
    And this:
             Tank tank = GetObject("Tank") as Tank;

    OK, got it, it's a   Tank!
La la land's where weak typing goes
    And this:
             Tank tank = GetObject("Tank") as Tank;

    OK, got it, it's a   Tank!
La la land's where weak typing goes
    And this:
             Tank tank = GetObject("Tank") as Tank;

    OK, got it, it's a   Tank!
La la land's where weak typing goes
    And this:
             Tank tank = GetObject("Tank") as Tank;

    OK, got it, it's a   Tank!




                                                      This is a tank
Ti's right to make everything private
Ti's right to make everything private
It started innocently enough, as:

        class Foo {
                public:
                          int share_this;
                          int share_that;
                          // ...
        }

But then this was seen as too easy by the designers of C#.
Ti's right to make everything private
Since they decided that sharing information should be painful to a
programmer, they insisted on:

        class Foo {
                public int share_this;
                public int share_that;
                        // ...
        }
Ti's right to make everything private
Since they decided that sharing information should be painful to a
programmer, they insisted on:

        class Foo {
                public int share_this;
                public int share_that;
                        // ...
        }

        // uh uh, wait...
Ti's right to make everything private
Since they decided that sharing information should be painful to a
programmer, they insisted on:

        public class Foo {
                public int share_this;
                public int share_that;
                        // ...
        }
Ti's right to make everything private
Of course, after a while you get sick of having your compiles fail....
Ti's right to make everything private
Of course, after a while you get sick of having your compiles fail....



         ...So you just put public in front of everything.
Ti's right to make everything private
   Typing public all the time is tedious
Ti's right to make everything private
   Typing public all the time is tedious
   It slows you down when you forget
Ti's right to make everything private
   Typing public all the time is tedious
   It slows you down when you forget
   95% of the code you write will never be part of some giant
    architecture.
Ti's right to make everything private
   Typing public all the time is tedious
   It slows you down when you forget
   95% of the code you write will never be part of some giant
    architecture.
   When you a prototyping you often do not know in advance
    what you want to be public
Ti's right to make everything private
   Typing public all the time is tedious
   It slows you down when you forget
   95% of the code you write will never be part of some giant
    architecture.
   When you a prototyping you often do not know in advance
    what you want to be public
   Because C# does not support the friend keyword, there is no
    easy way to make data visible only to certain objects, so you
    make everything public anyway.
Ti's right to make everything private
   Typing public all the time is tedious
   It slows you down when you forget
   95% of the code you write will never be part of some giant
    architecture.
   When you a prototyping you often do not know in advance
    what you want to be public
   Because C# does not support the friend keyword, there is no
    easy way to make data visible only to certain objects, so you
    make everything public anyway.
   It's not even the right kind of privacy
Ti's right to make everything private
What you really want is interfaces that can only be called by
authorised modules...
Ti's right to make everything private
What you really want is interfaces that can only be called by
authorised modules...

  Maybe it would be good if only
  certain modules are
  authorised to call AddFunds()?
Ti's right to make everything private
What you really want is interfaces that can only be called by
authorised modules...

  Maybe it would be good if only
  certain modules are
  authorised to call AddFunds()?
And that brings us back to Don't.

      Don't think you know my needs better than me
And that brings us back to Don't.

      Don't think you know my needs better than me
      Don't take my tools away
And that brings us back to Don't.

      Don't think you know my needs better than me
      Don't take my tools away
      Don't restrict creativity
And that brings us back to Don't.

      Don't   think you know my needs better than me
      Don't   take my tools away
      Don't   restrict creativity
      Don't   complicate the simple in the name of an ideal
And that brings us back to Don't.

      Don't   think you know my needs better than me
      Don't   take my tools away
      Don't   restrict creativity
      Don't   complicate the simple in the name of an ideal
      Don't   stop me doing what needs to be done
And that brings us back to Don't.

      Don't   think you know my needs better than me
      Don't   take my tools away
      Don't   restrict creativity
      Don't   complicate the simple in the name of an ideal
      Don't   stop me doing what needs to be done
      Don't   keep arguing with me
And that brings us back to Don't.

      Don't   think you know my needs better than me
      Don't   take my tools away
      Don't   restrict creativity
      Don't   complicate the simple in the name of an ideal
      Don't   stop me doing what needs to be done
      Don't   keep arguing with me
      Don't   get in my way
Dont Bring Me Down
Ad

Recommended

PDF
Infrastructure as code might be literally impossible / Joe Domato (packageclo...
Ontico
PDF
Spring, CDI, Jakarta EE good parts
Jarek Ratajski
PDF
Arduino programming of ML-style in ATS
Kiwamu Okabe
PPT
scaling compiled applications - highload 2013
ice799
PDF
ATS/LF for Coq users
Kiwamu Okabe
PDF
Why I Love Python V2
gsroma
PPT
The Once And Future Script Loader (v2)
Kyle Simpson
ODP
How to join open source development
Kan-Ru Chen
PDF
Metasepi team meeting #17: Invariant captured by ATS's API
Kiwamu Okabe
PDF
Python overview
Haroon Karim
PDF
Killer Bugs From Outer Space
J辿r担me Petazzoni
PDF
Inheritance Versus Roles - The In-Depth Version
Curtis Poe
ODP
Perl Moderno
Tiago Peczenyj
PDF
Learning Python from Data
Mosky Liu
ODP
Only You Can Prevent Cthulhu
Andrew Grimm
PDF
Celebrating 30-th anniversary of the first C++ compiler: let's find bugs in it.
PVS-Studio
PPTX
Simplifying training deep and serving learning models with big data in python...
Holden Karau
PPTX
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Holden Karau
PPTX
Tensorflow go
Patrick Walker
PPT
Pr辿sentation allah
Berboura Hamid
PPTX
Union Budget 2012-13 Budget final
aniket satam
PPTX
Biometrics
Jeevjyot Singh Chhabda
PPTX
Destrucci坦 d'hbitats
ionac
PPTX
Simplest ai trick gdc2013 dino v2 (1)
Dino Dini
PPTX
The polling problem
Dino Dini
PDF
Giving Code a Good Name
Kevlin Henney
PDF
The Evolution of Good Code
Arjan van Leeuwen
PDF
60 terrible tips for a C++ developer
Andrey Karpov
PDF
C++ Restrictions for Game Programming.
Richard Taylor
PPT
Stroustrup c++0x overview
Vaibhav Bajaj

More Related Content

What's hot (11)

PDF
Metasepi team meeting #17: Invariant captured by ATS's API
Kiwamu Okabe
PDF
Python overview
Haroon Karim
PDF
Killer Bugs From Outer Space
J辿r担me Petazzoni
PDF
Inheritance Versus Roles - The In-Depth Version
Curtis Poe
ODP
Perl Moderno
Tiago Peczenyj
PDF
Learning Python from Data
Mosky Liu
ODP
Only You Can Prevent Cthulhu
Andrew Grimm
PDF
Celebrating 30-th anniversary of the first C++ compiler: let's find bugs in it.
PVS-Studio
PPTX
Simplifying training deep and serving learning models with big data in python...
Holden Karau
PPTX
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Holden Karau
PPTX
Tensorflow go
Patrick Walker
Metasepi team meeting #17: Invariant captured by ATS's API
Kiwamu Okabe
Python overview
Haroon Karim
Killer Bugs From Outer Space
J辿r担me Petazzoni
Inheritance Versus Roles - The In-Depth Version
Curtis Poe
Perl Moderno
Tiago Peczenyj
Learning Python from Data
Mosky Liu
Only You Can Prevent Cthulhu
Andrew Grimm
Celebrating 30-th anniversary of the first C++ compiler: let's find bugs in it.
PVS-Studio
Simplifying training deep and serving learning models with big data in python...
Holden Karau
Powering Tensorflow with big data using Apache Beam, Flink, and Spark - OSCON...
Holden Karau
Tensorflow go
Patrick Walker

Viewers also liked (6)

PPT
Pr辿sentation allah
Berboura Hamid
PPTX
Union Budget 2012-13 Budget final
aniket satam
PPTX
Biometrics
Jeevjyot Singh Chhabda
PPTX
Destrucci坦 d'hbitats
ionac
PPTX
Simplest ai trick gdc2013 dino v2 (1)
Dino Dini
PPTX
The polling problem
Dino Dini
Pr辿sentation allah
Berboura Hamid
Union Budget 2012-13 Budget final
aniket satam
Destrucci坦 d'hbitats
ionac
Simplest ai trick gdc2013 dino v2 (1)
Dino Dini
The polling problem
Dino Dini
Ad

Similar to Dear compiler please don't be my nanny v2 (20)

PDF
Giving Code a Good Name
Kevlin Henney
PDF
The Evolution of Good Code
Arjan van Leeuwen
PDF
60 terrible tips for a C++ developer
Andrey Karpov
PDF
C++ Restrictions for Game Programming.
Richard Taylor
PPT
Stroustrup c++0x overview
Vaibhav Bajaj
PPTX
THE BASIC TOOLS
Ouzhanahin15
PDF
Industry - Program analysis and verification - Type-preserving Heap Profiler ...
ICSM 2011
PPT
C#/.NET Little Wonders
BlackRabbitCoder
PDF
C++ Training
SubhendraBasu5
PDF
How to make a large C++-code base manageable
corehard_by
PPT
Course1
Constantin Nicolae
PPTX
Object Oriented Programming (OOP) Introduction
SamuelAnsong6
PDF
Clean code
Khou Suylong
PPTX
Unit 1
donny101
PPTX
Ahieving Performance C#
Roman Atachiants
ODP
Preventing Complexity in Game Programming
Yaser Zhian
PPTX
#GDC15 Code Clinic
Mike Acton
PDF
Thoughts On Learning A New Programming Language
Patricia Aas
PPTX
C++11 - A Change in Style - v2.0
Yaser Zhian
PPT
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
Bill Dubie
Giving Code a Good Name
Kevlin Henney
The Evolution of Good Code
Arjan van Leeuwen
60 terrible tips for a C++ developer
Andrey Karpov
C++ Restrictions for Game Programming.
Richard Taylor
Stroustrup c++0x overview
Vaibhav Bajaj
THE BASIC TOOLS
Ouzhanahin15
Industry - Program analysis and verification - Type-preserving Heap Profiler ...
ICSM 2011
C#/.NET Little Wonders
BlackRabbitCoder
C++ Training
SubhendraBasu5
How to make a large C++-code base manageable
corehard_by
Object Oriented Programming (OOP) Introduction
SamuelAnsong6
Clean code
Khou Suylong
Unit 1
donny101
Ahieving Performance C#
Roman Atachiants
Preventing Complexity in Game Programming
Yaser Zhian
#GDC15 Code Clinic
Mike Acton
Thoughts On Learning A New Programming Language
Patricia Aas
C++11 - A Change in Style - v2.0
Yaser Zhian
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
Bill Dubie
Ad

Dear compiler please don't be my nanny v2

  • 1. Dear compiler: Please don't be my Nanny Speaker Name Dino Dini NHTV University of Applied Sciences
  • 3. Nanny says: Don't you ever use goto
  • 4. Nanny says: Don't you ever use goto Regard preprocessors as bad
  • 5. Nanny says: Don't you ever use goto Regard preprocessors as bad Might we suggest always saying new
  • 6. Nanny says: Don't you ever use goto Regard preprocessors as bad Might we suggest always saying new Fact is OOP should make you glad
  • 7. Nanny says: Don't you ever use goto Regard preprocessors as bad Might we suggest always saying new Fact is OOP should make you glad So you want overload?
  • 8. Nanny says: Don't you ever use goto Regard preprocessors as bad Might we suggest always saying new Fact is OOP should make you glad So you want overload? La la land's where weak typing goes
  • 9. Nanny says: Don't you ever use goto Regard preprocessors as bad Might we suggest always saying new Fact is OOP should make you glad So you want overload? La la land's where weak typing goes Ti's right to make everything private
  • 10. Nanny says: Don't you ever use goto Regard preprocessors as bad Might we suggest always saying new Fact is OOP should make you glad So you want overload? La la land's where weak typing goes Ti's right to make everything private And that brings us back to Don't.
  • 11. Don't you ever use goto
  • 12. Don't you ever use goto Contrary to popular belief, goto is not evil. Sometimes it can be the right tool for the job, especially when:
  • 13. Don't you ever use goto Contrary to popular belief, goto is not evil. Sometimes it can be the right tool for the job, especially when: Prototyping non production code
  • 14. Don't you ever use goto Contrary to popular belief, goto is not evil. Sometimes it can be the right tool for the job, especially when: Prototyping non production code Trying to fix bugs in finished code with minimal risks
  • 15. Don't you ever use goto Contrary to popular belief, goto is not evil. Sometimes it can be the right tool for the job, especially when: Prototyping non production code Trying to fix bugs in finished code with minimal risks Porting legacy code
  • 16. Don't you ever use goto Contrary to popular belief, goto is not evil. Sometimes it can be the right tool for the job, especially when: Prototyping non production code Trying to fix bugs in finished code with minimal risks Porting legacy code Implementing state machines
  • 17. Don't you ever use goto If the code would have been clearer with a goto, then perhaps a goto was the best thing to use.
  • 18. Don't you ever use goto If the code would have been clearer with a goto, then perhaps a goto was the best thing to use. Java does not support goto, but still reserves the keyword. Adding goto support would take minutes, and would not end the world.
  • 19. Don't you ever use goto If the code would have been clearer with a goto, then perhaps a goto was the best thing to use. Java does not support goto, but still reserves the keyword. Adding goto support would take minutes, and would not end the world. I Feel a disturbance in the Force...
  • 21. Regard preprocessors as bad I can decide for myself when it is appropriate to use macros or conditional compilation.
  • 22. Regard preprocessors as bad I can decide for myself when it is appropriate to use macros or conditional compilation. Java does not even allow conditional compilation, and it is hilarious, the hoops that you have to jump through as a result.
  • 23. Regard preprocessors as bad I can decide for myself when it is appropriate to use macros or conditional compilation. Java does not even allow conditional compilation, and it is hilarious, the hoops that you have to jump through as a result.
  • 24. Regard preprocessors as bad Some legitimate uses:
  • 25. Regard preprocessors as bad Some legitimate uses: Porting legacy code
  • 26. Regard preprocessors as bad Some legitimate uses: Porting legacy code Avoiding repetitive boilerplate
  • 27. Regard preprocessors as bad Some legitimate uses: Porting legacy code Avoiding repetitive boilerplate Abstracting of identifiers
  • 28. Regard preprocessors as bad Some legitimate uses: Porting legacy code Avoiding repetitive boilerplate Abstracting of identifiers Implementing support for multitasking
  • 29. Regard preprocessors as bad Some legitimate uses: Porting legacy code Avoiding repetitive boilerplate Abstracting of identifiers Implementing support for multitasking Registration of string to object mapping
  • 30. Regard preprocessors as bad Some legitimate uses: Porting legacy code Avoiding repetitive boilerplate Abstracting of identifiers Implementing support for multitasking Registration of string to object mapping And much, much more stuff that's not computer sciency, but helps you Get Stuff DoneTM
  • 31. Regard preprocessors as bad C# learned the lesson of conditional compilation, but still will not let me use macros. Which means more...
  • 32. Regard preprocessors as bad C# learned the lesson of conditional compilation, but still will not let me use macros. Which means more...
  • 33. Might we suggest always saying new
  • 34. Might we suggest always saying new It is a sad fact of life that programs have to allocate memory, which is messy and slow and affects performance. But to rub it in all the time is just plain senseless.
  • 35. Might we suggest always saying new It is a sad fact of life that programs have to allocate memory, which is messy and slow and affects performance. But to rub it in all the time is just plain senseless. Vector3 vec = current + new Vector3(1,2,3); DoSomethingImportant( new Vector3(a,b,c), new Vector3(d,e,f), new Vector3(g,h,i));
  • 36. Might we suggest always saying new This is what would actually happen if experienced programmers were not constantly reminded that doing stuff causes memory allocations:
  • 37. Might we suggest always saying new This is what would actually happen if experienced programmers were not constantly reminded that doing stuff causes memory allocations: Nothing....
  • 38. Might we suggest always saying new And it's not as if C# is consistent, is it?
  • 39. Might we suggest always saying new And it's not as if C# is consistent, is it? You are forced to say new all the time, but can then create accessors that could actually end the world through what looks like an innocent variable read.
  • 40. Might we suggest always saying new DebugOut ( fluffyKitten.name );
  • 41. Might we suggest always saying new DebugOut ( fluffyKitten.name );
  • 42. Fact is OOP should make you glad Object orientated programming did not turn out to be the cure for our ills.
  • 43. Fact is OOP should make you glad Are objects really the best building blocks of code?
  • 44. Fact is OOP should make you glad Are objects really the best building blocks of code? How about keeping data and functionality separate instead?
  • 45. Fact is OOP should make you glad Are objects really the best building blocks of code? How about keeping data and functionality separate instead? The first thing an architect seems to do with OOP is separate data from functionality through interfaces.
  • 46. Fact is OOP should make you glad Are objects really the best building blocks of code? How about keeping data and functionality separate instead? The first thing an architect seems to do with OOP is separate data from functionality through interfaces. Compilers are generally designed around the OOP model, making it harder to solve programming problems in other ways.
  • 47. Fact is OOP should make you glad This means more...
  • 48. Fact is OOP should make you glad This means more...
  • 49. So you want to overload?
  • 50. So you want to overload? Overloading functions and operators really can be very useful, but many languages refuse to support them for dubious reasons.
  • 51. So you want to overload? Overloading functions and operators really can be very useful, but many languages refuse to support them for dubious reasons. Javascript does not even support overloaded functions.
  • 52. So you want to overload? Lets compare two pseudo code fragments:
  • 53. So you want to overload? Lets compare two pseudo code fragments: Vector3 N = ( pos1 - pos2 ) . Normalise(); pos1 += N * speed;
  • 54. So you want to overload? Lets compare two pseudo code fragments: Vector3 N = ( pos1 - pos2 ) . Normalise(); pos1 += N * speed; // or Vector3 N = NormaliseVector3( sub2Vector3( pos1,pos2 )); AddToVector3( ScaleVector3( N, speed ));
  • 55. So you want to overload? Lets compare two pseudo code fragments: Vector3 N = ( pos1 - pos2 ) . Normalise(); pos1 += N * speed; // or Vector3 N = NormaliseVector3( sub2Vector3( pos1,pos2 )); AddToVector3( ScaleVector3( N, speed )); Questions?
  • 56. La la land's where weak typing goes
  • 57. La la land's where weak typing goes The only reason for strong typing is, let's face it, performance.
  • 58. La la land's where weak typing goes The only reason for strong typing is, let's face it, performance. Why, oh why, does C# insist I put an f on my floats?
  • 59. La la land's where weak typing goes The only* reason for strong typing is, let's face it, performance. Why, oh why, does C# insist I put an f on my floats? float f = 10.5; // come on compiler, be sensible // It feels like I spend most of my // fixing this when you complain * Disclaimer: This is a rant
  • 60. La la land's where weak typing goes float f = 10.5;
  • 61. La la land's where weak typing goes float f = 10.5; It's a constant! What on earth does the error serve?
  • 62. La la land's where weak typing goes float f = 10.5; Here's what would happen if you relaxed...
  • 63. La la land's where weak typing goes float f = 10.5; Here's what would happen if you relaxed... Nothing....
  • 64. La la land's where weak typing goes And this: Tank tank = GetObject("Tank") as Tank;
  • 65. La la land's where weak typing goes And this: Tank tank = GetObject("Tank") as Tank; OK, got it, it's a Tank!
  • 66. La la land's where weak typing goes And this: Tank tank = GetObject("Tank") as Tank; OK, got it, it's a Tank!
  • 67. La la land's where weak typing goes And this: Tank tank = GetObject("Tank") as Tank; OK, got it, it's a Tank!
  • 68. La la land's where weak typing goes And this: Tank tank = GetObject("Tank") as Tank; OK, got it, it's a Tank! This is a tank
  • 69. Ti's right to make everything private
  • 70. Ti's right to make everything private It started innocently enough, as: class Foo { public: int share_this; int share_that; // ... } But then this was seen as too easy by the designers of C#.
  • 71. Ti's right to make everything private Since they decided that sharing information should be painful to a programmer, they insisted on: class Foo { public int share_this; public int share_that; // ... }
  • 72. Ti's right to make everything private Since they decided that sharing information should be painful to a programmer, they insisted on: class Foo { public int share_this; public int share_that; // ... } // uh uh, wait...
  • 73. Ti's right to make everything private Since they decided that sharing information should be painful to a programmer, they insisted on: public class Foo { public int share_this; public int share_that; // ... }
  • 74. Ti's right to make everything private Of course, after a while you get sick of having your compiles fail....
  • 75. Ti's right to make everything private Of course, after a while you get sick of having your compiles fail.... ...So you just put public in front of everything.
  • 76. Ti's right to make everything private Typing public all the time is tedious
  • 77. Ti's right to make everything private Typing public all the time is tedious It slows you down when you forget
  • 78. Ti's right to make everything private Typing public all the time is tedious It slows you down when you forget 95% of the code you write will never be part of some giant architecture.
  • 79. Ti's right to make everything private Typing public all the time is tedious It slows you down when you forget 95% of the code you write will never be part of some giant architecture. When you a prototyping you often do not know in advance what you want to be public
  • 80. Ti's right to make everything private Typing public all the time is tedious It slows you down when you forget 95% of the code you write will never be part of some giant architecture. When you a prototyping you often do not know in advance what you want to be public Because C# does not support the friend keyword, there is no easy way to make data visible only to certain objects, so you make everything public anyway.
  • 81. Ti's right to make everything private Typing public all the time is tedious It slows you down when you forget 95% of the code you write will never be part of some giant architecture. When you a prototyping you often do not know in advance what you want to be public Because C# does not support the friend keyword, there is no easy way to make data visible only to certain objects, so you make everything public anyway. It's not even the right kind of privacy
  • 82. Ti's right to make everything private What you really want is interfaces that can only be called by authorised modules...
  • 83. Ti's right to make everything private What you really want is interfaces that can only be called by authorised modules... Maybe it would be good if only certain modules are authorised to call AddFunds()?
  • 84. Ti's right to make everything private What you really want is interfaces that can only be called by authorised modules... Maybe it would be good if only certain modules are authorised to call AddFunds()?
  • 85. And that brings us back to Don't. Don't think you know my needs better than me
  • 86. And that brings us back to Don't. Don't think you know my needs better than me Don't take my tools away
  • 87. And that brings us back to Don't. Don't think you know my needs better than me Don't take my tools away Don't restrict creativity
  • 88. And that brings us back to Don't. Don't think you know my needs better than me Don't take my tools away Don't restrict creativity Don't complicate the simple in the name of an ideal
  • 89. And that brings us back to Don't. Don't think you know my needs better than me Don't take my tools away Don't restrict creativity Don't complicate the simple in the name of an ideal Don't stop me doing what needs to be done
  • 90. And that brings us back to Don't. Don't think you know my needs better than me Don't take my tools away Don't restrict creativity Don't complicate the simple in the name of an ideal Don't stop me doing what needs to be done Don't keep arguing with me
  • 91. And that brings us back to Don't. Don't think you know my needs better than me Don't take my tools away Don't restrict creativity Don't complicate the simple in the name of an ideal Don't stop me doing what needs to be done Don't keep arguing with me Don't get in my way