Git Hub and Intro - quiz and workshop answers PDF

Title Git Hub and Intro - quiz and workshop answers
Course Programming Fundamentals
Institution University of Lincoln
Pages 7
File Size 335.6 KB
File Type PDF
Total Downloads 29
Total Views 153

Summary

quiz and workshop answers...


Description

But why ‘object-oriented’? • An OO language contains: • Class • Object • Data (variables) • Its state

• Methods (functions/procedures) • Its behaviour

• Class descriptions of a ‘thing’ can contain objects from another class • Eg: ‘Output’ class • Object of Output in And

• Code for outputting details held in one object rather than duplicating it for each class

• Reduces duplication/repetition • ‘DRY’ (don’t repeat yourself)

But why ‘object-oriented’? • Classes can be arranged and linked together

Person

• ‘Inheritance’

• Recognition that some are related and can therefore share code • More reduction of repetition and duplication

Teacher

Student

getAge() could be defined in Person and would be inherited by Student and Teacher

Object oriented …. • Modelling • Models real world • Chair object, has colour, number of legs, etc • Makes sense to link colour, no. Of legs to instance of chair

• Reusability • Good class design, means that it can be reused in different settings • A restaurant has many chairs – only one class for chair though

• Ease of testing • Individual classes can be tested in isolation

C# vs Python • C#

• Python

• Object Oriented • ‘Statically typed’ • Compiler gives errors for wrong typecasting (‘var’ keyword tries to reduce this though)

• Static – everything has to be built/compiled • Owned by Microsoft • Open source versions exist • https://github.com/dotnet/csharplang

• Supports Object Oriented paradigm (+ others) • ‘Dynamically typed’ • Variable declarations are not needed

• Dynamic – objects/references etc are picked during run time • Open source

git • Version Control System (VCS) • Allows management and monitoring of codebase • Files are kept in a repository • Repositories (‘repos’) can be local or remote • User edits and changes a working copy • Changes to this working copy are then committed to the repo • Other people can access the repo and get the code • Use to manage code across multiple computers

Git commands used … touch Creates empty file git init Initialises directory as git enabled git add Adds named file or files from WD to local staging area git status Tells us of the status of out local repo git log Tells us of what commits we have made to our local repo git add . Add all files from working directory to staging area git commit -m Commit files in staging area to local repo git remote add origin Add github (for example) repo address to enable push git push origin master Push files in local repo to ‘master’ branch of repo address git push origin dev Push files in local repo to ‘dev’ branch of repo address...


Similar Free PDFs