software development fundamentals

41
SOFTWARE DEVELOPMENT FUNDAMENTALS by: A.J. Grandeza, Co-founder Lean Agenda

Upload: alfred-jett-grandeza

Post on 23-Jan-2017

248 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Software development fundamentals

SOFTWARE DEVELOPMENT FUNDAMENTALS

by: A.J. Grandeza, Co-founder Lean Agenda

Page 2: Software development fundamentals

Topics1. About Lean Agenda2. About the Speaker3. Expectations4. Core Programming – the basics5. Object Oriented Principles – the essentials6. S.O.L.I.D. Principles7. Industry needs and expectations AND TIPS!

Page 3: Software development fundamentals

The Lean Agenda• A branch of Lean Consulting PH

• We aim to narrow the gap between school knowledge and industry expectations

• Prepare and educate people on the 21st century skills

Page 4: Software development fundamentals

About Me• Graduate of Ateneo de Davao, Computer Science 2012

• Over 5 years of software engineering experience, .NET and AngularJS

• Co-founder/CTO of T.H.E. Patrons (ex-CTO)

• Co-founder of Lean Consulting, Lean Agenda

• Microsoft Technology Associate

• I LIKE TO LEARN!

Page 5: Software development fundamentals

What to expect• Programming Language: C#• Only fundamentals will be discussed• Not your typical what-is-a and this-is-a discussion• Feel free to ask• Feel free to correct the speaker• Feel free to add• Learn something new!

Page 6: Software development fundamentals

What I except from you• Your attention• Questions!• You have at least little knowledge on programming

Because we won’t just be discussing definitions We will have a why-when type of discussion

Page 7: Software development fundamentals

Core Programming – the basics• What is a variable?

Holds a value temporarily in a computer memory

• What is a constant? Same as variable BUT cannot be changed on runtime or during program

execution

• What is a data type? Classification of the type of a data – Integer, Boolean

Page 8: Software development fundamentals

Core Programming – Data types

Page 9: Software development fundamentals

Why is it important to know the data type?

Page 10: Software development fundamentals

In simple terms…Variable – is the containerData type – is the type of container

Do you want to put cookies in a tumbler?

No!

Page 11: Software development fundamentals

Well, technically...• Using the correct data type will save space – in memory, only use

what you need You don’t need to use int for “Age”. Nobody gets 2,147,483,647 years old

• Because you won’t be able to multiply a string… 2 * “2”

• It is an implementation detail

Page 12: Software development fundamentals

Double vs Float vs Decimal• Precision is the main difference

• Float: 7 digits• Double: 15-16 digits

Both are floating binary point types Faster than decimal

• Decimal: 28-29 digits Floating decimal point types Mainly used in financial solutions Slower than the other 2

Page 13: Software development fundamentals

Core Programming – Data structures• Arrays• Dictionaries

Page 14: Software development fundamentals

Arrays• A collection of variables• C# arrays are zero indexed

Page 15: Software development fundamentals

Dictionaries• A collection of objects that are accessed by using a key• Use dictionary if your indexes have a special meaning besides just

positional placement

Page 16: Software development fundamentals

Core Programming - Decision Making• If, if-else, if-else-if VS Switch

• Switch is faster (a little) However, this is just a micro-optimization

• Switch is more readable• Use switch if you have many items, if-else if fewer

Page 17: Software development fundamentals

Core Programming - Repetition• For• While• Do while

Page 18: Software development fundamentals

When to use for loop?• you can run a statement or a block of statements repeatedly until a

specified expression evaluates to false

• Useful for arrays

• When the number of times is known before hand

• Example: Displaying all data in a list

Page 19: Software development fundamentals

When to use while?•  executes a statement or a block of statements until a specified

expression evaluates to false.

• When the number of times is NOT known before hand

• Example: when your program is waiting for a form to be completed, it will not save the form

Page 20: Software development fundamentals

When to use do-while• Almost the same with while BUT is executed one time before the

conditional expression is evaluated

• When the number of times is NOT known before hand AND you want to make sure it will be executed at least once

• Example: Display a question, and if the answer is correct move on to the next question.

Page 21: Software development fundamentals

Core Programming – Exception Handling• What is an exception?

An exception is a problem that arises during the execution of a program.

• Try identifies a block of code for which particular exceptions is activated

• Catch the place in a program where you want to handle the problem

• Finally is used to execute a given set of statements, whether an exception is thrown or

not thrown

• Throw is used to signal the occurrence of an anomalous situation (exception) during the

program execution

Page 22: Software development fundamentals

Core Programming – Exception Handling• A try-catch structure doesn’t prevent the exception from being

thrown, it simply gives the developer a chance to keep the program from crashing.

• When to use? When you are trying to do something that may not work

• When not to use? To hide problems happening in your code

• Demo

Page 23: Software development fundamentals

Object Oriented - Principles• What is OOP?

Is a programming paradigm based on objects

• Is it useful? Why? Code reusability Provides clear modular structure for programs Software components can be easily adapted and modified

• What are its disadvantages? Over complication Complexity in understanding “established” code – especially for beginners Prone to code spaghetti

Page 24: Software development fundamentals

Classes• Can be reused

• It’s like a blueprint

• Includes attributes and behaviour

Page 25: Software development fundamentals

Abstraction• Exposing essential feature

• Hides irrelevant detail

• Process of identifying common patterns that have systematic variations

Page 26: Software development fundamentals

Encapsulation• Hide implementation details• Creates a black box• Behaviour can be exposed through interfaces• Data members cannot be directly changed• Encapsulation is implemented by using access specifiers

Private Public Protected Internal Protected Internal

Page 27: Software development fundamentals

Inheritance• Data & behaviour taken from another class

• Concept of super and sub class

• Provides base functionality for similar objects

• Allows for code re-use

• Use the “is-a” test if it’s appropriate to use

Page 28: Software development fundamentals

Polymorphism• Poly = multiple

• Morph = to change

• Polymorphism = multiple forms or changes

• Behaviour change

• Virtual methods and overriding

Page 29: Software development fundamentals

Abstract Class VS Interfaces• Abstract class

Cannot be instantiated Must be inherited from May be fully implemented, partially implemented or not implemented at all

• Why do we need abstract classes? To provide some sort of default functionality Affects all derived classes if there are changes on the base class

Page 30: Software development fundamentals

Abstract Class VS Interfaces• Interface

Totally abstract set of members No implementation, contains only signatures Represents a contract In real world, a medium to interact with something

• Why do we need Interfaces? Multiple inheritance support Used in service contracts Loose coupling Modularity

Page 31: Software development fundamentals

S.O.L.I.D. Principles• What is S.O.L.I.D. ?

• Basic principles which help you create good software architecture• Acronym for

Single Responsibility Principle Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle

Page 32: Software development fundamentals

Single Responsibility Principle• A class should have one responsibility only

• Separation of concern

• A class is not a swiss knife

• Demo

Page 33: Software development fundamentals

Open Closed Principle• Should be open for extension but closed for modification

• Demo

Page 34: Software development fundamentals

Liskov Substitution Principle• objects in a program should be replaceable with instances of their

subtypes without altering the correctness of that program

• Demo

Page 35: Software development fundamentals

Interface Segregation Principle• many client-specific interfaces are better than one general-purpose

interface

• Demo

Page 36: Software development fundamentals

Dependency Inversion Principle• Depend on abstractions, not on concretions

• Demo

Page 37: Software development fundamentals

What to expect in the real world• “If you think teachers are tough, wait till you get a boss” – Bill Gates

• Do not expect any training

• Be ready to read, read and read

• If you get bored easily on tedious work, programming is for you!

Page 38: Software development fundamentals

What to learn & how to improve• If you’re a beginner, master one programming language• After, strategically choose another language• Master SQL. Everything is all about data.• Learn Version Control, it’ll save a lot of time and plus points on

applying for work!• Constantly challenge yourself• Join GitHub, StackOverflow• Don’t be lazy, always follow best practices until it becomes a habit• Constantly learn new things• Always ask why

Page 39: Software development fundamentals

Any questions?

Page 40: Software development fundamentals

•“ Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ” - Martin Fowler

Page 41: Software development fundamentals

References• http://stackoverflow.com/questions/618535/difference-between-decimal-float-and-double-in-net• https://msdn.microsoft.com/en-us/library/cs7y5x0x%28v=vs.90%29.aspx• http://csharpindepth.com/Articles/General/FloatingPoint.aspx• https://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx• http://programmers.stackexchange.com/questions/139052/dictionary-vs-list• https://msdn.microsoft.com/en-us/library/ch45axte.aspx• http://wiki.tcl.tk/13398• https://standardofnorms.wordpress.com/2012/09/02/4-pillars-of-object-oriented-programming/• http://www.c-sharpcorner.com/UploadFile/d0e913/abstract-class-interface-two-villains-of-every-

interview/• http://www.c-sharpcorner.com/UploadFile/d0e913/abstract-class-interface-two-villains-of-every-intervi

ew756/

• http://www.c-sharpcorner.com/UploadFile/yusufkaratoprak/difference-between-loose-coupling-and-tight-coupling/

• http://www.codeproject.com/Articles/703634/SOLID-architecture-principles-using-simple-Csharp