Got Qt? 10 things to know before you code

16
Got Qt? 10 Things to Know Before You Code Justin Noel Senior Consulting Engineer ICS, Inc.

Transcript of Got Qt? 10 things to know before you code

Page 1: Got Qt? 10 things to know before you code

Got Qt? 10 Things to Know Before You Code

Justin NoelSenior Consulting Engineer

ICS, Inc.

Page 2: Got Qt? 10 things to know before you code

The Right Tools• Qt is huge!

• Study the API and docs for hidden treasure:• QML Styling: QQmlFileSelector• Web Services: QNetworkAccessManager

• There are other toolkits to help• Boost, Vtk, FFMpeg, libusb

• Don’t be afraid to look around for solutions• Complex video rendering?

• Maybe QtMultimedia fits. Maybe not.

Page 3: Got Qt? 10 things to know before you code

The Right People• Staff the project up early.

• Don’t hold your “big push” for the end• Consult with experts (internally or externally)

• For each of your “hard parts”• Also for each toolkit

• Get training!• Avoid re-inventing the wheel!

• Get advice early!

Page 4: Got Qt? 10 things to know before you code

User Experience (UX)• User Experience is vital to a project’s success• Start early with a Human Centered Design

• Good UX should optimize and simplify the user’s workflow

• Especially true for embedded devices and mobile

Page 5: Got Qt? 10 things to know before you code

Iterative UX• Engineering must be a stake holder in all UX

activity• Make sure UX maps to realities of HW and SW

stack• Rework UX? Or does the stack need changing?

• User Experience process needs to be iterative just like the software process

• UX needs to start the project a month ahead of engineering• You will catch them. Also you will need UX

support.

Page 6: Got Qt? 10 things to know before you code

Be Agile• Agile is more than just daily standups and

design on demand• Although both of these help quite a bit• The next 5 points are all agile related

• Keep standup very short. 3 questions:• What did I do yesterday?• What will I do today?• Does anything prevent work from continuing?

Page 7: Got Qt? 10 things to know before you code

Test Early• Earlier you can test code the more traceable

it is.• What went wrong? Why?• Can we stop it from happening again?

• Is our pattern wrong?

• QTest is good unit testing framework• Has Qt specific things: Test events and signals

• GTest and GMock are much more powerful• Qt compatible. Can use features of QTest

Page 8: Got Qt? 10 things to know before you code

Be Testable• Structure code and design to be testable

• Build as libraries, DI, Signals/Slot Interfaces

Backend.dll

App.exe(only main.cpp)

Ui.dll

BackendTests.exe UiTests.exe

C++ Test Fixtures QML Test Fixtures

Page 9: Got Qt? 10 things to know before you code

Layered Design• Qt and a Layered Design can help Testability

and Demo-ability

Visualization Layer (QML)

Presentation Layer (QObjects)

Data Layer (Local Data Storage)

Communications Layer (TCP)

CallsDown

SignalsUp

Page 10: Got Qt? 10 things to know before you code

QML as Visualization Only• The best QML advice is Keep It Simple!• QML is the best UI visualization toolkit

• Let it do what it does best: Draw and Animate.• Let C++ classes take care of the rest

• Business logic, Storage, etc• Even UI flow in some cases

• See the Qt State Machine talks!

Page 11: Got Qt? 10 things to know before you code

Always Be Delivering• Deliver from Day 1

• Spend Day 0 setting up a Continuous Integration Server

• Create installer scripts for what little code you have

• Always be ready to distribute or demo the code.• Being able to run “off device” is quite helpful for

getting stake holder feedback.

Page 12: Got Qt? 10 things to know before you code

Always Be Reviewing• Code review is essential

• Is the code correct?• Does it follow project patterns and style?• Cross-pollination of developer knowledge

• Code review servers are best• ICS suggests Gerrit

• Pre-commit checks / review• Same system that the Qt Project uses

Page 13: Got Qt? 10 things to know before you code

Don’t Be Too Agile• Know your schedule.

• It’s easy to put off creating stories until immediately before the sprint starts.

• Create rough estimates for large tasks as soon as they are known• Don’t need to be super accurate. Iterate over time.• Points or time

• Having these will provide a rough estimate for completion• Also as new requirements arise you can predict

schedule impact

Page 14: Got Qt? 10 things to know before you code

Checklist Big Items• You should know what to expect for “the hard

parts”• External Interfaces• Fancy Renderings• Performance Requirements

• Create a checklist and assign research tasks• Find “Unknown Unknowns”

• These can kill your schedule if they arise late

Page 15: Got Qt? 10 things to know before you code

Internationalize Early• Internationalize from Day 1

• Wrap user visible string in tr / translate• Use QLocale for all numbers and dates

• Create a dummy translation file for testing• A script can update a .ts with fake translations

• Ceasar Cipher (ROT-13) works well• Verify all the strings / dates / numbers change

• As you deliver each screen!

Page 16: Got Qt? 10 things to know before you code

Thank You!

Justin NoelSenior Consulting Engineer

ICS, Inc.