Prerequisites for creating a project in WPF with C# - c#

I have been thinking a lot lately about making a fully functional project with a small team using C# WPF UI. The goal is to create a construction management software. It is not about "reinventing the wheel", the idea behind this is to gain experience in software programming.
Some of the general knowledge that we possess:
We have been introduced in OOP at the University.
We have programmed in Visual Studio before, but only standard C#.
We watched this playlist of Tutorials on WPF
We have also been looking at some tamplates on Telerik, but our understanding in WPF is too shallow right now to comprehend them.
Some of the things we would love to understand:
What SQL Server would be appropriate for this kind of software, we used Microsoft SQL Server so far.
Any recommendation of books that might help us enhance our skill in building a database such as: reading from it, creating appropriate relation-ships, etc would be greatly appreciated.
Any recommendation of books for C#, LINQ or anything you know and might help us.
We want to treat this project seriously and we know that we will struggle with this documentation step for quite a while. Please let us know if there is any other step or fundamental thing that we missed, thank you!

With WPF you should use MVVM. Unfortunately, there are no good books that will teach you that though.
I have a bunch of articles and samples on TechNet wiki and Gallery. A number of these originated from coaching and teaching newbies.
https://social.technet.microsoft.com/wiki/contents/articles/30959.user-page-andy-oneill.aspx
Some of what's in there ought to help.
Use viewmodel first for navigation.
Don't use pages, use usercontrols and bind content to a property returns a viewmodel.
Template using datatype=vmtype into usercontrols in the ui.
I think redcurry's recommendation of pro c#7 is good. I like Jon Skeet's c# in depth.
For database theory.
Bear in mind it has changed very little in 20 years. Hence rather old books are still good and you can pick up copies really cheap nowadays. For example https://www.amazon.co.uk/dp/0201752840?slotNum=0&linkCode=g12&imprToken=uS5pZKPLsrVEOJop6zd4iA&creativeASIN=0201752840&tag=javarevisit01-21 well worth a fiver.
My big tips on indexing:
By default - add an auto integer as primary key rather than using any natural key you think will "always" be unique. They inevitably change.
Don't add too many indexes.
The old advice is still true. Normalise 'til it hurts and then denormalise 'til it works.
SQL server is good, easy to find online advice and sql express is free. Jobs are very useful but the "full" version of sql server is expensive. If you will have large quantities of sql server and low/no budget then MySQL.
There are free resources for sql server on the web. For example http://www.sqlservercentral.com/
I've never read a book on LINQ. I learnt it as I went by looking up stuff on the web. I rely heavily on intellisense when writing anything isn't fairly simple. My big tip on LINQ is not to use it for complex queries and as complexity increases in one you're writing you should look at the generated sql. Complicated linq is prone to generating terribly inefficient sql.

I really enjoyed the book Pro C# 7. I think it's very well written and comprehensive. It even covers WPF at a reasonable level. There are also chapters on dealing with SQL databases.
Once you're familiar with C# and some WPF basics, you can read Windows Presentation Foundation 4.5 Cookbook. I found that their specific examples and explanations helped me understand how WPF works.
Then it's about getting your hands dirty by trying things out. You'll find a lot of resources online as you search for problems you run into. There are tons of blog posts explaining specific WPF solutions, and of course there's StackOverflow.
Good luck.

Related

What kind of application should I develop for the purpose of learning right concepts of programming

I work as a ERP programmer, mostly with MS SQL and some kind of scripting programming language.
I also wrote some simple projects in C# (a web application for our company and a simple windows service) and I like it very much, so my next job will hopefully be in .NET environment.
Now I'm learning C# from a Wrox book and I went through all the basics chapters. This is all fine and nice, but in my opinion a better way to learn a language is through a real project. So my question is: what kind of application should I write, so that I can use all the fancy-named concepts, like inheritance, delegates, generics, reflection, LINQ,... It would be nice if it also connects to SQL Server.
I thought about personal expense management system or scheduling system. Any other ideas?
Rule number one in such projects: It must be fun thing, or something you expect to profit from it.
When I was in the same place as you (and I mean the same...C#...WROX book...) I went for an engine of text based Adventure Games.
It has everything you described above, and more important I had fun writing it and later see people play it.
So, it really isn't important what you choose, as long as you enjoy it (and it's scope is big enough).
Any well-designed application could use any or all of those concepts. Language-specific books have a tendency to focus exclusively on language details (for good reason) and generally neglect basic design principles. Another important point is that delegates, generics, reflection, etc. all have their place, but they shouldn't be implemented in an application just "because". That can cause unnecessary complexity.
All of that said, pick a project that interests you. Even better, something that you would actually like to use. Then, before even coding, think about how you should structure the application so that it is easy to modify later and add features. If you're putting all the code in the form/code-behind page, you're probably doing something wrong.
Spend some time learning design patterns. These are "best practices" of organizing code that have developed over time. No need to reinvent the wheel.
Hope this helps.
Scratch your own personal itch...
I'd go for some sort of simple CRUD application, which will exercise your database skills (and give you an opportunity to use a LINQ provider against your database), but perhaps not too simple; i.e. more than one table.
There's nothing about a given problem that will make it inherently better to learn from. It's probably a good idea to stick to a domain which you can easily design and model against, to remove that aspect from the challenge. You might look at doing something "more" than just data access operations; perhaps something involving graphing or other processing of the data which will give you an opportunity to learn some other API.
Your suggestions (expenses management, scheduler) seem reasonably good to me.
If you want to try all those "fancy concepts", better make a project that does not reflect at all anything you might do at work. E.g. write a game. If you create a small CRUD application but somehow manage to use inheritance, generics, delegates etc., chances are your program is much more complex than it should. Next time you do something similar at work, you might be tempted to do it the same way. Which would be a real bad idea. (KISS principle)
Thanks for all the answers, with your inspiration I found theme for my project :-)
It is an IS for a Brothel. We keep a list of our Clients, Hookers, Rooms, Available Services, Job histories, Prices,...
Now I created all tables in SQL (with primary, foreign keys and indexes), what is next step? Should I for every table in SQL create it's own class in C# and then add methods to it? And then continue building my Program from this base? Or should I use another approach...?
Thanks
Go for some basic CRUD app - Video Management System, Student Registration System, Pet Store Inventory System, etc...
You could always look at an open-source project that uses C#... Usually, they have a lot of the different concepts that you'd like to look into...
-JFV
You could write an engine that supports adventure-style games - nothing too fancy, but I find that it makes a good beginner project as you can end up working with lots of OO. You could also make a basic media player, although I can't see that being quite so good for getting the fundamentals of the language down. You could even get the XNA Framework and try to write a simple game!

What's a quick way to familiarize myself with C#, .NET framework, etc?

I just graduated college and will be starting working in about a month and I was asked to familiarize myself with C++, C#, .NET framework for NT Services and web services.
I'd appreciate recommendations on how to familiarize myself with these topics (books? internet links?) in a short time span. I don't expect to be an expert on it in a month but I don't want to be clueless either. I already know C++ and I consider myself to be fairly proficient in it and I know the basics of C# even though I haven't used it all that much. For C# I do own a book called O'Reilley Programming C#.
Thanks!
I would start by pulling down Microsoft's Visual Studio Express products. Your O'Reilly book is a perfectly good book to start with.
Start reading blogs and listening to podcasts, to begin to familiarize yourself with all of the technologies out there that surround c#. You will be very excited about what you can learn. Here are some of the better ones:
http://www.hanselminutes.com/
http://www.dotnetrocks.com/
http://channel9.msdn.com/
http://weblogs.asp.net/scottgu/
http://weblogs.asp.net/
In addition, the MSDN library is an invaluable resource. You can almost always find what you need there. This is where the reference for the entire .NET framework lives.
http://msdn.microsoft.com/en-us/library/default.aspx
Happy hunting!
Nothing beats actually using the language. As much as some of the information sources already quoted would be very useful to check out, I'd say make sure that you at least try and write some concrete C#.
The best place to start might be a non-trivial-but-not-too-large application that you have already written in something you know, and try to convert it to C#... even better if you can get somebody proficient in C# to peer-review your results to make suggestions where you could make better use of the language-specific features that may be new to you.
Fundamentally, if you just read books and watch videos, you may feel like you actually know it, but it is nothing like doing it yourself (as my Uni maths classes taught me... a good teacher can make the impossible look trivial on a blackboard).
That is a huge surface area. Pro C# 2008 and the .NET 3.5 Platform by Andrew Troelsen is a good place to start.
These are good podcasts that will give you an overview:
.NET Rocks
dnrTV
Herding Code
Microsoft Labs and Webcasts
Here's a good SO thread with lots of resources. I recommend you check out MSDN Virtual Labs. They have lots of great training that let's you get your hands on the technology, in particular, check out the C# ones.
I was in the same situation in late November 2008.
If you are familiar with IDEs and another programming language, download Visual Studio Express and start playing with it. It's free :)
http://www.microsoft.com/express/
And I always recommend this webpage:
http://www.java2s.com/Tutorial/CSharp/CatalogCSharp.htm
You can select the relative topic you are interested on this stackoverflow site based on the tag name, and read through some posts, it will give you a good feeling what are common issues/challenges people face in day-to-day programming.
One way is listening to podcasts. We do one called Deep Fried Bytes that contains a variety of topics on any and everything.

Should I learn Openedge as a C# programmer

We have an Progress OpenEdge (http://en.wikipedia.org/wiki/Progress_4GL) develop team in the company I work for.
I'm the only c# developer there and really like it. So now the manager asks me to learn programming in OpenEdge. He doesn't want me to become a good OpenEdge programmer but he wants the team members to understand both worlds. He hopes the team will benefit from this.
I'm not unwilling to learn but I want to become a better developer and there are so many more aspects of .Net I like to discover.
So are there there any good point about Progress OpenEdge I would profit from or should I stay away from it.
OpenEdge is a powerful framework for building CRUD applications; but it is a niche skill with no SAP-like salary premium for possessing it; conversely decent OpenEdge developers are hard to get hold of for bog standard rates - it would not be unknown for a manager to recruit an OpenEdge developer by the backdoor.
The core ABL (OpenEdge language) is different enough a language from the mainstream to be interesting for an inquisitive programmer and for your bosses arguments for everyone to understand where the others are coming from to make sense.
So, bearing those points in mind:
It's worth learning the basics to enrich your understanding of your core competencies, along the lines of "What should they of England know, who only England know?". You may also find the ease of data access eye-opening.
It is not worth spending too much time distracted from developing your expertise in a framework which is infinitely more widely used.
If your manager wants you to learn OpenEdge, then he has a reason for it. One reason could be that you will be taking on some of the development, perhaps providing cover when others are off. The other reason could be, as he says, that he want the team to understand both worlds.
What you need to find out is if the Progress people are going to be looking at .NET as well. If not, you know which of these reasons he has in mind.
It is never a bad idea to learn new (and different!) languages. It keeps the mind working and teaches you concepts that might not be available in your language. Learning OpenEdge will have no adverse effects on your C# knowledge and you can likely learn them in tandem. I personally am currently reading up on C#, Python, PHP, Ruby and Groovy all while doing most of my work in Java, I simply want to know everything. (Not to mention reading about multiple frameworks for said languages).
In short, you will always profit from learning a new language as it will give you a different perspective than the one you are used to.
What version of OpenEdge are you using? I might be biased but I would say that yes it is worth it. There are people looking for OpenEdge developers and with Progress recently releasing a product we call "OpenEdge GUI for .Net" that allows you build .Net frontends with .Net controls using only OpenEdge ABL code, there will be more and more shops that will be looking for people that have an understanding of the OO .Net world but also understand ABL.
One of the other good things about the ABL is that it is Extremely backwards compatible (no VB6 nightmares when we upgrade versions) (although some may say this backwards compatibility is a fault).
The ABL now is mixing its tradition Procedule manner with OO concepts so you can use one or the other or both theories depending on what makes sense.
The main thing I imagine you will be learning is the data access components and yes, that won't help you out in the .Net world, but I think you will find it easier to learn then other data access and so, will be an asset to have.
Lastly, if you have a good grounding in .Net as it seems you have, you will be a great asset to your employer (and be another box to tick on future job applications) in helping their OpenEdge devlopers understand the .Net ideas. I don't think progress will ever make ABL compile to CLR code (excuse me if I have terminology wrong. Is it meant to be bit code? You know the code that runs in a .Net VM) but they do know that .Net is winning the Desktop battle and they are borrowing a few concepts (.Net GUI and Datasets for one). I would hope (bias again) that you would look at some of the OE data access and say, I wish .Net had an easy way to do that!
It is a niche but niches can be very worthwhile. It can also be like being stuck in mud. Which it turns out to be depends on lots of factors but as others have said it is always good to learn new stuff.
I make 75 euro's an hour with my 12 years of Progress / Webspeed / Sonic experience.
OpenEdge seems is mostly used by software developers for building products. End users typically only interact with the rdbms end of an application. Learning any new language is a good thing IMHO, and the more different it is to what you are used to the better - we learn better when our assumptions and habits are challenged and extended. OE as a rdbms is pretty much "set and forget" needing very little in the way of maintenance. Suggest you go to the Progress forums online and look for the DBA Admin guide, work through that, then read the Embedded SQL because that will probably make more sense to you in short space of time.
And after all of that is digested just go ahead and write something. Nothing beats putting rubber to the road and building something usable. Ask the other dev's for a support problem, or a sinple form to get built, and just do it.
If your code interacts with an OpenEdge program, then it behooves you to learn something about the environment so you can interact with it better.

Looking for feedback from people that have gone from 100% web development to winforms

I have been a web developer for my entire development career. Nearly 100% microsoft focused the entire time. I have been using .Net, both C# and VB.Net, since beta. I now find myself in a position to where I have the opportunity to start doing some WinForms development in C# using the 3.5 framework. As with anything new, I am excited about the learning opportunity in front of me.
I am curious if anyone has any suggested books, articles, feedback, etc on the topic of transitioning from web development to winforms in the .Net world.
I think it goes without saying that the paradigms are very different. I really enjoy C# because of how easy it is to write great windows software.
Start by getting into the IDE and creating a real but small project. One of my first C# projects was a light weight budget program. That took me into many areas of C#, from XML handling to custom windows controls, to debugging, and more.
Experience is the best teacher. Take time to look at the function lists, and peruse the documentation. Get a feel for what is in the thousands of classes that make up .NET.
Reading books can be nice, but getting your hands dirty (in conjunction with a good book) is far more effective.
Set a goal and go for it, you will have no problem learning all about it. Don't be afraid to try things and take risks -- it helps you learn the system.
If you are moving from Web to Windows, there is a some significant differences between the two enviroments. Some good and some are bad. If your .Net based and moving to 3.5 look into WPF since it is the best of both worlds for Web developers converting right now.
I do know of some common mistakes made by web developers making the crossover. They would include:
Opening database connections on every form and every database calls. (In Windows Bad)
There is no ViewState concept or Stateless concept in Windows
I am sure there is a few more that can be added but right now I can't think of an exact list.
I do agree with gahooa, look at doing a small project and read as much as possible on the subject. Approach it as if you never developed before, and the skills you gained over the years will automatically kick in when needed.

How to stop worrying about using the best materials and just start learning .Net?

For the past few years whenever I learn something I tend to spend way too much time researching on the best materials for the subject than actually studying it. What should I do to get over this mentality? I am stuck. How to stop worrying about getting or using the BEST books, training videos and online materials on .net and just start learning?
Start doing a project with a deadline. You will code and learn together. If you cannot do that at work, think of a hobby project with some real requirements (like building a photo sharing site).
I completely agree on the just start coding philosophy. Another idea for a project is to go through the Project Euler exercises. They are somewhat simple math problems that get progressively harder. It is great if you can not think of a project or only have a little bit of time. Then just use a reference book, or the internet to learn what you need to about the language specifics.
Go download Visual Studio Express
http://www.microsoft.com/Express/
Go buy one of the following books:
ASP.NET 3.5 Step by Step
C# 2008 Step by Step
VB.NET 2008 Step by Step
From my experience (when I first started with .NET back in the 1.0 days) the Step by Step books from Microsoft are the best at just starting out and getting your feet wet with .NET.
1) Stop researching
2) Start programming
Seriously, the only book you need to program in .NET is CLR Via C# by Jeffrey Richter. Read it cover to cover (save the first couple chapters until you've read the rest, btw), and start coding. When you hit stuff you have problems with (Linq, WPF, source control, unit testing), come here.
Buy visual studio 08, devise a small project, and complete it.
Make a deadline for yourself and don't push it back.
Buy a basic C# book for reference, don't worry about which one.
You can do it!
Firstly, don't beat yourself up for not having done things the right way before, as I'm sure you know, there never is a right way. Also, some of that searching for the best resources will pay for itself when you have a better understanding of things than the next guy. And, as has already been said, do a project, pick something harder than the usual, trivial examples, so that you have to think and ask questions and do some research. Finally, if you have a blog then post about what you are up to, that way you'll have more of a sense of a commitment to stay working on the project rather than bailing out as it gets hard, especially as that is usually the time when you are about to actually learn something (this works for me anyway!)
There is no single best resource on anything. The best way to learn is to practice. Get any book to get yourself started. Then just start writing some code at home. Play with the language and the platform. Read blogs, browse the questions here. You will start discovering and learning nuggets of information.
Others mentioned buying Visual Studio 2008. It can be an expensive investment although it is totally worth it if you are a independent developer/consultant. However, if you just need something to get you started with coding, get the free Visual C# Express. You can always grow into the professional SKUs when you need it.
The best way is learn by doing!
When you work at a new job, you learn a lot because you have great individuals who transfer a lot of knowledge they find useful. You can review how they do things, which parts are done well and which parts are done poorly.
Learning by isolation is hard especially when there are so many resources out there.
I recommend connecting with individuals in your local community user group or an online group, or start your own group. Many of these individuals will have had real-world experience and can help direct your learning path more effectively.
Find an area of .Net you'd like to use, e.g. console Applications, Windows Applications, ASP.Net applications, web services, and just build a few little "getting your feet wet" sort of things like the basic "Hello World!" example or doing some simple computations or using an MS-SQL back-end if you do get SQL Express or the richer versions.
Don't forget that if you don't get in, some things may pass you by. How many ASP.Net 1.0 or 1.1 apps are out there using older systems that you may not be familiar with yet may be an incentive to start doing rather than trying to find the BEST that will be out of date in a few years. Take some of the ideas from a book like "Refactoring" by Martin Fowler if you want to program something a little bigger than the simple "Hello World!" program.
Download Visual C# Express 2008. Google for intro tutorials. Dig in and explore yourself.
This URL is all you need to get started with .NET:
http://msdn.microsoft.com/en-us/vcsharp/aa336768.aspx?wt.slv=RightRail
If you want mastery of .NET, there a lot of different ideas, but only one official self-education track. Get the official MCTS / MCPD training guides from Microsoft Press. These are searchable on Amazon by Exam number, such as Exam 70-536. But as long as you know how to Google for questions and tutorials, you don't need much else.

Categories