Jump to content

Making win32 api C++ calculator. Want feed back.

I am trying to teach myself win32 api in C++ by making a simple calculator in Visual Studio 2017. I am having success and making progress so far. Yet, I don't have any feedback on how my code is structured. I would appreciate if people could give me some constructive criticism.

I am trying to gain experience to land a Software Engineering position. I had to take a test recently after a job interview and some of the questions pertained to program development. At this point I realized that I don't have any real understanding of the process of software development, I just know how to code. So any advice in planning, layout or structure would be appreciated. I am also looking to get into any collaborative work if you think anything would suit me.

I attached a zip folder of my Visual Studio Project folder. This is not a final project so it doesn't actually do anything yet. My biggest accomplishment was just getting the user interface all setup and functional. My next step is actually doing the calculations and than figuring out how to add menus to windows (its confusing me, requires resources?).

Thanks

GitHub:

https://github.com/StrictlyDominick/win32Calculator

 

Project Folder:

win32Calculator.zip

Link to comment
Share on other sites

Link to post
Share on other sites

It's a nice simple project to start with when you are new, but upload the source to GitHub? Some people may be sceptical to just download something.

Hello

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, TAHIRMIA said:

It's a nice simple project to start with when you are new, but upload the source to GitHub? Some people may be sceptical to just download something.

Ya...never used github before.

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, ProfoundDisputes said:

Ya...never used github before.

Then you should learn then too. Branching for hot fixes and new features then merging back into master, at work we branch from develop and merge back then once it's ready then it's merged to master for release.

 

Its something I didn't know we'll before getting this job so I highly recommend putting the time in.

 

As for code structure that depends on how you're coding. An object orientated style will look very different to a functional one.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

13 minutes ago, ProfoundDisputes said:

Ya...never used github before.

Would recommend looking into it. Makes sharing and working on project versions a lot easier.

Hello

Link to comment
Share on other sites

Link to post
Share on other sites

12 minutes ago, vorticalbox said:

Then you should learn then too. Branching for hot fixes and new features then merging back into master, at work we branch from develop and merge back then once it's ready then it's merged to master for release.

 

Its something I didn't know we'll before getting this job so I highly recommend putting the time in.

 

As for code structure that depends on how you're coding. An object orientated style will look very different to a functional one.

I have heard of GitHub before but never really understood why it was so big. This kinda points to what I think I lack. I just don't understand a lot of the backend stuff like organizing files and how you distribute code and the like. There really doesn't appear to be very accessible youtube tutorials or simple material on this type of process besides long lengthy text books. I honestly lose interest pretty quick unless I can actually start programming.

I have taken Structured Programming in C++ college course. Also visual basic and c++ in highschool (5+ years ago). I have been mostly teaching myself inheritance, classes and pointers myself.

My goal is to make this project Object Oriented, thought I am not entirely sure I how to design around that frame.

 

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, TAHIRMIA said:

Would recommend looking into it. Makes sharing and working on project versions a lot easier.

More than willing too. Will link it once I get it setup.

Link to comment
Share on other sites

Link to post
Share on other sites

22 minutes ago, ProfoundDisputes said:

I have heard of GitHub before but never really understood why it was so big. This kinda points to what I think I lack. I just don't understand a lot of the backend stuff like organizing files and how you distribute code and the like. There really doesn't appear to be very accessible youtube tutorials or simple material on this type of process besides long lengthy text books. I honestly lose interest pretty quick unless I can actually start programming.

I have taken Structured Programming in C++ college course. Also visual basic and c++ in highschool (5+ years ago). I have been mostly teaching myself inheritance, classes and pointers myself.

My goal is to make this project Object Oriented, thought I am not entirely sure I how to design around that frame
 

There's no standard on how to organize your source files as long as it make sense and is consistent. Most people though just dump the source files into "src" or something.

 

If you want an example... I have a JavaScript based user script that I use on a website and share with other users. Given that the user script is one large file that was getting unruly to maintain, I found ways to organize each piece by function which I call "modules". Then I split up each module into its own source file. I wrote a script that basically stitches the modules together into one file.

 

This is the folder structure I went with

  • ./docs (for documentation)
  • ./output (for the output when I "compile" the user script)
  • ./src (source files)
    • ./core-modules (Modules that must be present)
    • ./feature-modules (modules that are technically optional)
    • Some source files that aren't modules like the main header of the user script and the "entry point"
Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, ProfoundDisputes said:

and than figuring out how to add menus to windows (its confusing me, requires resources?).

 

12 hours ago, ProfoundDisputes said:

My goal is to make this project Object Oriented, thought I am not entirely sure I how to design around that frame.

Normally, you'd be using a framework to build your application along with the visual design tools that come with them. For example, MFC (Microsoft foundation classes) with visual studio or Qt with Qt creator. The visual design tool allows you to literally "draw" your windows and menus in stead of hardcoding them. The framework code and classes are made with object oriented design in mind. You build upon the framework skeleton application and most things you want to do "snap" right in, you can have a basic application up and running in minutes, there's no need to handle the underlying nitty gritty yourself like you did. (However, there's nothing wrong with doing it the hard way as you have at least once to better understand the underlying systems).

Link to comment
Share on other sites

Link to post
Share on other sites

17 hours ago, TAHIRMIA said:

Would recommend looking into it. Makes sharing and working on project versions a lot easier.

Just got around to it. I tried to set it up as best I can. Though the file text formatting is messed up in a lot of places not sure why github does that:

https://github.com/ProfoundDisputes/win32Calculator

Edited by ProfoundDisputes
Made it clear I was talking about file text format
Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, Unimportant said:

 

Normally, you'd be using a framework to build your application along with the visual design tools that come with them. For example, MFC (Microsoft foundation classes) with visual studio or Qt with Qt creator. The visual design tool allows you to literally "draw" your windows and menus in stead of hardcoding them. The framework code and classes are made with object oriented design in mind. You build upon the framework skeleton application and most things you want to do "snap" right in, you can have a basic application up and running in minutes, there's no need to handle the underlying nitty gritty yourself like you did. (However, there's nothing wrong with doing it the hard way as you have at least once to better understand the underlying systems).

I understand what you mean. I made few applications in VB that had a GUI editor and the like. I wanted to practice making GUI applications in C++ but I was having a really hard time deciding on what to do. Its so different from what I was doing with Visual Basic. So I happen to come across the win32 API and for some reason that made more sense to me.

I also was unsure what to spend so much time on. I heard that MFC was outdated or something and I couldn't get a straight answer. Nothing seemed to give me what I wanted. I didn't like that Qt appears to be not well used in industry and didn't want to spend time developing skills that didn't pertain to a job in my area.

Link to comment
Share on other sites

Link to post
Share on other sites

 

Code structure looks fine to me, Nothing I can think right now to improve but others may have improvements.

Hello

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, MyName13 said:

Why are you using winapi?Where did you learn it from?

I briefly went over why in my response to Unimportant.

 

I didn't like the look of Qt applications. I also was under the impression that Qt isn't widely used and didn't think I would gain much from learning their framework. I was massively confused about MFC and .Net related material. I am the type of person that needs to know everything about something before I can use it. So when I started reading about win32 api and how its the basic for the object oriented frameworks even if I never use it directly it would be a great learning experience.


I learned by lots of self research. I use MSDN alot as a reference too. Once I understood the message loop and the way win32 api is structured things just started clicking and MSDN helped a lot. Though, I am still really new at it but I feel like I have made massive progress so far. I was so confused in the beginning.

Link to comment
Share on other sites

Link to post
Share on other sites

Maybe u are not interested in this, but when u are making the actual calculator, u can use something called the Shunting yard algorithm. Its easy to understand.

Link to comment
Share on other sites

Link to post
Share on other sites

On 3/7/2018 at 3:34 PM, TAHIRMIA said:

It's a nice simple project to start with when you are new, but upload the source to GitHub? Some people may be sceptical to just download something.

You can store anything on github. I had been planning to use it to store my porn collections but keeping them private needs a fee:/

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, wasab said:

You can store anything on github. I had been planning to use it to store my porn collections but keeping them private needs a fee:/

xD, I don't think they play video natively on the site anyway.

Hello

Link to comment
Share on other sites

Link to post
Share on other sites

17 minutes ago, TAHIRMIA said:

xD, I don't think they play video natively on the site anyway.

Never planned to store videos. I wanted to store some dirty magazines and images. :D

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×